Class: SyntaxTree::Params::OptionalFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::Params::OptionalFormatter
- Defined in:
- lib/syntax_tree/node.rb
Overview
Formats the optional position of the parameters. This includes the label, as well as the default value.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
- Ident
-
the name of the parameter.
-
#value ⇒ Object
readonly
- Node
-
the value of the parameter.
Instance Method Summary collapse
- #comments ⇒ Object
- #format(q) ⇒ Object
-
#initialize(name, value) ⇒ OptionalFormatter
constructor
A new instance of OptionalFormatter.
Constructor Details
#initialize(name, value) ⇒ OptionalFormatter
Returns a new instance of OptionalFormatter.
8222 8223 8224 8225 |
# File 'lib/syntax_tree/node.rb', line 8222 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
8217 8218 8219 |
# File 'lib/syntax_tree/node.rb', line 8217 def name @name end |
#value ⇒ Object (readonly)
- Node
-
the value of the parameter
8220 8221 8222 |
# File 'lib/syntax_tree/node.rb', line 8220 def value @value end |
Instance Method Details
#comments ⇒ Object
8227 8228 8229 |
# File 'lib/syntax_tree/node.rb', line 8227 def comments [] end |
#format(q) ⇒ Object
8231 8232 8233 8234 8235 |
# File 'lib/syntax_tree/node.rb', line 8231 def format(q) q.format(name) q.text(" = ") q.format(value) end |