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 | Node
-
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.
8247 8248 8249 8250 |
# File 'lib/syntax_tree/node.rb', line 8247 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
8242 8243 8244 |
# File 'lib/syntax_tree/node.rb', line 8242 def name @name end |
#value ⇒ Object (readonly)
- nil | Node
-
the value of the parameter
8245 8246 8247 |
# File 'lib/syntax_tree/node.rb', line 8245 def value @value end |
Instance Method Details
#comments ⇒ Object
8252 8253 8254 |
# File 'lib/syntax_tree/node.rb', line 8252 def comments [] end |
#format(q) ⇒ Object
8256 8257 8258 8259 8260 8261 8262 8263 |
# File 'lib/syntax_tree/node.rb', line 8256 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |