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.
8206 8207 8208 8209 |
# File 'lib/syntax_tree/node.rb', line 8206 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
8201 8202 8203 |
# File 'lib/syntax_tree/node.rb', line 8201 def name @name end |
#value ⇒ Object (readonly)
- Node
-
the value of the parameter
8204 8205 8206 |
# File 'lib/syntax_tree/node.rb', line 8204 def value @value end |
Instance Method Details
#comments ⇒ Object
8211 8212 8213 |
# File 'lib/syntax_tree/node.rb', line 8211 def comments [] end |
#format(q) ⇒ Object
8215 8216 8217 8218 8219 |
# File 'lib/syntax_tree/node.rb', line 8215 def format(q) q.format(name) q.text(" = ") q.format(value) end |