Class: RBI::KwOptParam
- Inherits:
-
Param
show all
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb
Instance Attribute Summary collapse
Attributes inherited from Param
#name
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
#merge_with, #oneline?
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
#initialize(name, value, loc: nil, comments: [], &block) ⇒ KwOptParam
676
677
678
679
680
|
# File 'lib/rbi/model.rb', line 676
def initialize(name, value, loc: nil, comments: [], &block)
super(name, loc: loc, comments: )
@value = value
block&.call(self)
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
665
666
667
|
# File 'lib/rbi/model.rb', line 665
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
688
689
690
|
# File 'lib/rbi/model.rb', line 688
def ==(other)
KwOptParam === other && name == other.name && value == other.value
end
|
#accept_printer(v) ⇒ Object
464
465
466
|
# File 'lib/rbi/printer.rb', line 464
def accept_printer(v)
v.print("#{name}: #{value}")
end
|
469
470
471
472
|
# File 'lib/rbi/printer.rb', line 469
def (v, last:)
super
v.print(" " * (value.size + 2))
end
|
#to_s ⇒ Object
683
684
685
|
# File 'lib/rbi/model.rb', line 683
def to_s
"#{name}:"
end
|