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.
8190 8191 8192 8193 |
# File 'lib/syntax_tree/node.rb', line 8190 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
8185 8186 8187 |
# File 'lib/syntax_tree/node.rb', line 8185 def name @name end |
#value ⇒ Object (readonly)
- nil | Node
-
the value of the parameter
8188 8189 8190 |
# File 'lib/syntax_tree/node.rb', line 8188 def value @value end |
Instance Method Details
#comments ⇒ Object
8195 8196 8197 |
# File 'lib/syntax_tree/node.rb', line 8195 def comments [] end |
#format(q) ⇒ Object
8199 8200 8201 8202 8203 8204 8205 8206 |
# File 'lib/syntax_tree/node.rb', line 8199 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |