Sha256: 8eb839d71c23f09661b69b8bf1670279c2658905e5685cbc3f663b4754211057

Contents?: true

Size: 1.49 KB

Versions: 8

Compression:

Stored size: 1.49 KB

Contents

module IEgrip
  class GripWrapper
    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
    
    def raw
      @raw_object
    end
    
    def inspect()
      "<#{self.class}>"
    end
    
    def ole_methodNames
      list = []
      @raw_object.ole_methods.each {|ole_method|
        list.push ole_method.name
      }
      list
    end
    
    private
    
    OLE_METHODS = [:Type, :Initialize, :Name, :ID, :Method]
    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
    
    def toRaw(target_obj)
      target_obj.respond_to?("raw") ? target_obj.raw : target_obj
    end
  end
  
  class FileSystemObject
    include Singleton
    def initialize
      @body =  WIN32OLE.new('Scripting.FileSystemObject')
    end
    
    def fullpath(filename)
      @body.getAbsolutePathName(filename)
    end
    
    def GetFileVersion(fullpath)
      @body.GetFileVersion(fullpath)
    end
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
iegrip-0.1.7 lib/iegrip/GripWrapper.rb
iegrip-0.1.6 lib/iegrip/GripWrapper.rb
iegrip-0.1.5 lib/iegrip/GripWrapper.rb
iegrip-0.1.3 lib/iegrip/GripWrapper.rb
iegrip-0.1.0 lib/iegrip/GripWrapper.rb
iegrip-0.0.9 lib/iegrip/GripWrapper.rb
iegrip-0.0.8 lib/iegrip/GripWrapper.rb
iegrip-0.0.7 lib/iegrip/GripWrapper.rb