Class: IEgrip::GripWrapper

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

Direct Known Subclasses

Attr, Frame, Frames, IE, Node, NodeList

Instance Method Summary collapse

Constructor Details

#initialize(raw_object, ie_obj) ⇒ GripWrapper

Returns a new instance of GripWrapper.



3
4
5
6
7
8
9
10
# File 'lib/iegrip/GripWrapper.rb', line 3

def initialize(raw_object, ie_obj)
  if raw_object.methods.include?("raw")
    @raw_object = raw_object.raw
  else
    @raw_object = raw_object
  end
  @ie_obj = ie_obj
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m_id, *params) ⇒ Object (private)



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/iegrip/GripWrapper.rb', line 31

def method_missing(m_id, *params)
  unless OLE_METHODS.include?(m_id)
    missing_method_name = m_id.to_s.downcase
    methods.each {|method|
      if method.to_s.downcase == missing_method_name
        return send(method, *params)
      end
    }
  end
  # Undefined Method is throwed to raw_object

  begin
    @raw_object.send(m_id, *params)
  rescue
    raise $!,$!.message, caller
  end
end

Instance Method Details

#inspectObject



16
17
18
# File 'lib/iegrip/GripWrapper.rb', line 16

def inspect()
  "<#{self.class}>"
end

#ole_methodNamesObject



20
21
22
23
24
25
26
# File 'lib/iegrip/GripWrapper.rb', line 20

def ole_methodNames
  list = []
  @raw_object.ole_methods.each {|ole_method|
    list.push ole_method.name
  }
  list
end

#rawObject



12
13
14
# File 'lib/iegrip/GripWrapper.rb', line 12

def raw
  @raw_object
end