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.
6821 6822 6823 6824 |
# File 'lib/syntax_tree/node.rb', line 6821 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
6816 6817 6818 |
# File 'lib/syntax_tree/node.rb', line 6816 def name @name end |
#value ⇒ Object (readonly)
- nil | untyped
-
the value of the parameter
6819 6820 6821 |
# File 'lib/syntax_tree/node.rb', line 6819 def value @value end |
Instance Method Details
#comments ⇒ Object
6826 6827 6828 |
# File 'lib/syntax_tree/node.rb', line 6826 def comments [] end |
#format(q) ⇒ Object
6830 6831 6832 6833 6834 6835 6836 6837 |
# File 'lib/syntax_tree/node.rb', line 6830 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |