Class: Traverse::Document

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

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ Document

Returns a new instance of Document.



8
9
10
11
12
13
14
# File 'lib/traverse.rb', line 8

def initialize document
  if xml? document
    @proxy = XML.new document
  elsif json? document
    @proxy = JSON.new document
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object (private)



17
18
19
# File 'lib/traverse.rb', line 17

def method_missing m, *args, &block
  @proxy.send m, *args, &block
end