Class: Treetop::Runtime::SyntaxNode

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf_context/n3parser.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) info(ctx = ""))

Brief information about a syntax node



371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/rdf_context/n3parser.rb', line 371

def info(ctx = "")
  m = self.singleton_methods(true)
  if m.empty?
    ["@#{self.interval.first}", "#{ctx}['#{self.text_value}']"]
  else
    ["@#{self.interval.first}", "#{ctx}[" +
    self.singleton_methods(true).map do |m|
      v = self.send(m)
      v = v.text_value if v.is_a?(SyntaxNode)
      "#{m}='#{v}'"
    end.join(", ") +
    "]"]
  end
end