Class: RBI::KwOptParam
Instance Attribute Summary collapse
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
Methods inherited from Param
#compatible_with?
#annotations, #comments?, #merge_with, #version_requirements
Methods inherited from Node
#compatible_with?, #detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string
Constructor Details
#initialize(name, value, loc: nil, comments: nil, &block) ⇒ KwOptParam
Returns a new instance of KwOptParam.
763
764
765
766
767
768
|
# File 'lib/rbi/model.rb', line 763
def initialize(name, value, loc: nil, comments: nil, &block)
super(loc: loc, comments: )
@name = name.to_s @value = value
block&.call(self)
end
|
Instance Attribute Details
#name ⇒ Object
757
758
759
|
# File 'lib/rbi/model.rb', line 757
def name
@name
end
|
#value ⇒ Object
760
761
762
|
# File 'lib/rbi/model.rb', line 760
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
783
784
785
|
# File 'lib/rbi/model.rb', line 783
def ==(other)
KwOptParam === other && (name == other.name)
end
|
#anonymous? ⇒ Boolean
778
779
780
|
# File 'lib/rbi/model.rb', line 778
def anonymous?
false
end
|
#to_s ⇒ Object
772
773
774
|
# File 'lib/rbi/model.rb', line 772
def to_s
"#{name}: #{value}"
end
|