Class: RBI::Param
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::Param
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb
Direct Known Subclasses
BlockParam, KwOptParam, KwParam, KwRestParam, OptParam, ReqParam, RestParam
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #accept_printer(v) ⇒ Object
-
#initialize(name, loc: nil, comments: []) ⇒ Param
constructor
A new instance of Param.
- #print_comment_leading_space(v, last:) ⇒ Object
- #to_s ⇒ Object
Methods inherited from NodeWithComments
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
#initialize(name, loc: nil, comments: []) ⇒ Param
Returns a new instance of Param.
547 548 549 550 |
# File 'lib/rbi/model.rb', line 547 def initialize(name, loc: nil, comments: []) super(loc: loc, comments: comments) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
538 539 540 |
# File 'lib/rbi/model.rb', line 538 def name @name end |
Instance Method Details
#accept_printer(v) ⇒ Object
402 403 404 |
# File 'lib/rbi/printer.rb', line 402 def accept_printer(v) v.print(name.to_s) end |
#print_comment_leading_space(v, last:) ⇒ Object
407 408 409 410 411 412 |
# File 'lib/rbi/printer.rb', line 407 def print_comment_leading_space(v, last:) v.printn v.printt v.print(" " * (name.size + 1)) v.print(" ") unless last end |
#to_s ⇒ Object
553 554 555 |
# File 'lib/rbi/model.rb', line 553 def to_s name end |