Class: Onigmo::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/onigmo/node.rb,
ext/onigmo/onigmo.c

Overview

The base class for all nodes in the tree.

Instance Method Summary collapse

Instance Method Details

#accept(visitor) ⇒ Object

Raises:

  • (NoMethodError)


6
7
8
# File 'lib/onigmo/node.rb', line 6

def accept(visitor)
  raise NoMethodError, __method__
end

#as_jsonObject



19
20
21
# File 'lib/onigmo/node.rb', line 19

def as_json
  accept(JSONVisitor.new)
end

#deconstruct_keys(keys) ⇒ Object



10
11
12
# File 'lib/onigmo/node.rb', line 10

def deconstruct_keys(keys)
  accept(DeconstructVisitor.new)
end

#pretty_print(q) ⇒ Object



14
15
16
17
# File 'lib/onigmo/node.rb', line 14

def pretty_print(q)
  accept(PrettyPrintVisitor.new(q))
  q.flush
end

#to_json(*opts) ⇒ Object



23
24
25
# File 'lib/onigmo/node.rb', line 23

def to_json(*opts)
  as_json.to_json(*opts)
end