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
6999 7000 7001 7002 |
# File 'lib/syntax_tree/node.rb', line 6999 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
- Ident
-
the name of the parameter
6994 6995 6996 |
# File 'lib/syntax_tree/node.rb', line 6994 def name @name end |
#value ⇒ Object (readonly)
- nil | untyped
-
the value of the parameter
6997 6998 6999 |
# File 'lib/syntax_tree/node.rb', line 6997 def value @value end |
Instance Method Details
#comments ⇒ Object
7004 7005 7006 |
# File 'lib/syntax_tree/node.rb', line 7004 def comments [] end |
#format(q) ⇒ Object
7008 7009 7010 7011 7012 7013 7014 7015 |
# File 'lib/syntax_tree/node.rb', line 7008 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |