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 | untyped
-
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.
8114 8115 8116 8117 |
# File 'lib/syntax_tree/node.rb', line 8114 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
8109 8110 8111 |
# File 'lib/syntax_tree/node.rb', line 8109 def name @name end |
#value ⇒ Object (readonly)
- nil | untyped
-
the value of the parameter
8112 8113 8114 |
# File 'lib/syntax_tree/node.rb', line 8112 def value @value end |
Instance Method Details
#comments ⇒ Object
8119 8120 8121 |
# File 'lib/syntax_tree/node.rb', line 8119 def comments [] end |
#format(q) ⇒ Object
8123 8124 8125 8126 8127 8128 8129 8130 |
# File 'lib/syntax_tree/node.rb', line 8123 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |