Class: Excelgrip::GripWrapper

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

Direct Known Subclasses

Excel, Range, Workbook, Workbooks, Worksheet, Worksheets

Instance Method Summary collapse

Constructor Details

#initialize(raw_object) ⇒ GripWrapper

Returns a new instance of GripWrapper.



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

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/excelgrip/GripWrapper.rb', line 22

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



15
16
17
# File 'lib/excelgrip/GripWrapper.rb', line 15

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

#rawObject



11
12
13
# File 'lib/excelgrip/GripWrapper.rb', line 11

def raw
  @raw_object
end