Class: ShellOpts::Grammar::DocNode
- Defined in:
- lib/shellopts/grammar.rb,
lib/shellopts/formatter.rb
Overview
DocNode object has no children but lines.
Constant Summary
Constants inherited from Node
Instance Attribute Summary collapse
-
#tokens ⇒ Object
readonly
Array of :text tokens.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(parent, token, text = nil) ⇒ DocNode
constructor
A new instance of DocNode.
- #lines ⇒ Object
- #puts_descr ⇒ Object
-
#text ⇒ Object
The text of the node.
-
#to_s ⇒ Object
FIXME.
Methods inherited from Node
#analyzer_error, #ancestors, #dump_ast, #dump_attrs, #dump_idr, #inspect, #parents, #parse, parse, #parser_error, #puts_help, #puts_usage, #remove_arg_descr_nodes, #remove_arg_spec_nodes, #remove_brief_nodes, #traverse
Constructor Details
#initialize(parent, token, text = nil) ⇒ DocNode
Returns a new instance of DocNode.
329 330 331 332 333 |
# File 'lib/shellopts/grammar.rb', line 329 def initialize(parent, token, text = nil) @tokens = [token] @text = text super(parent, token) end |
Instance Attribute Details
#tokens ⇒ Object (readonly)
Array of :text tokens. Assigned by the parser
320 321 322 |
# File 'lib/shellopts/grammar.rb', line 320 def tokens @tokens end |
Instance Method Details
#lines ⇒ Object
325 |
# File 'lib/shellopts/grammar.rb', line 325 def lines() [text] end |
#puts_descr ⇒ Object
171 |
# File 'lib/shellopts/formatter.rb', line 171 def puts_descr() puts lines end |
#text ⇒ Object
The text of the node
323 |
# File 'lib/shellopts/grammar.rb', line 323 def text() @text ||= tokens.map(&:source).join(" ") end |
#to_s ⇒ Object
FIXME
327 |
# File 'lib/shellopts/grammar.rb', line 327 def to_s() text end |