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.
328 329 330 331 332 |
# File 'lib/shellopts/grammar.rb', line 328 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
319 320 321 |
# File 'lib/shellopts/grammar.rb', line 319 def tokens @tokens end |
Instance Method Details
#lines ⇒ Object
324 |
# File 'lib/shellopts/grammar.rb', line 324 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
322 |
# File 'lib/shellopts/grammar.rb', line 322 def text() @text ||= tokens.map(&:source).join(" ") end |
#to_s ⇒ Object
FIXME
326 |
# File 'lib/shellopts/grammar.rb', line 326 def to_s() text end |