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.
6719 6720 6721 6722 |
# File 'lib/syntax_tree/node.rb', line 6719 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
6714 6715 6716 |
# File 'lib/syntax_tree/node.rb', line 6714 def name @name end |
#value ⇒ Object (readonly)
- nil | untyped
-
the value of the parameter
6717 6718 6719 |
# File 'lib/syntax_tree/node.rb', line 6717 def value @value end |
Instance Method Details
#comments ⇒ Object
6724 6725 6726 |
# File 'lib/syntax_tree/node.rb', line 6724 def comments [] end |
#format(q) ⇒ Object
6728 6729 6730 6731 6732 6733 6734 6735 |
# File 'lib/syntax_tree/node.rb', line 6728 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |