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.
8221 8222 8223 8224 |
# File 'lib/syntax_tree/node.rb', line 8221 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
8216 8217 8218 |
# File 'lib/syntax_tree/node.rb', line 8216 def name @name end |
#value ⇒ Object (readonly)
- nil | Node
-
the value of the parameter
8219 8220 8221 |
# File 'lib/syntax_tree/node.rb', line 8219 def value @value end |
Instance Method Details
#comments ⇒ Object
8226 8227 8228 |
# File 'lib/syntax_tree/node.rb', line 8226 def comments [] end |
#format(q) ⇒ Object
8230 8231 8232 8233 8234 8235 8236 8237 |
# File 'lib/syntax_tree/node.rb', line 8230 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |