Class: SyntaxTree::Params::KeywordFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::Params::KeywordFormatter
- Defined in:
- lib/syntax_tree/node.rb
Overview
Formats the keyword position of the parameters. This includes the label, as well as an optional default value.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
[Ident] the name of the parameter.
-
#value ⇒ Object
readonly
[nil | untyped] the value of the parameter.
Instance Method Summary collapse
- #comments ⇒ Object
- #format(q) ⇒ Object
-
#initialize(name, value) ⇒ KeywordFormatter
constructor
A new instance of KeywordFormatter.
Constructor Details
#initialize(name, value) ⇒ KeywordFormatter
Returns a new instance of KeywordFormatter.
6765 6766 6767 6768 |
# File 'lib/syntax_tree/node.rb', line 6765 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
[Ident] the name of the parameter
6760 6761 6762 |
# File 'lib/syntax_tree/node.rb', line 6760 def name @name end |
#value ⇒ Object (readonly)
[nil | untyped] the value of the parameter
6763 6764 6765 |
# File 'lib/syntax_tree/node.rb', line 6763 def value @value end |
Instance Method Details
#comments ⇒ Object
6770 6771 6772 |
# File 'lib/syntax_tree/node.rb', line 6770 def comments [] end |
#format(q) ⇒ Object
6774 6775 6776 6777 6778 6779 6780 6781 |
# File 'lib/syntax_tree/node.rb', line 6774 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |