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