Module: Ragweed::FFIStructInclude

Overview

FFI Struct Accessor Methods

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



86
87
88
89
90
91
92
93
# File 'lib/ragweed.rb', line 86

def method_missing meth, *args
  super unless self.respond_to? meth
  if meth.to_s =~ /=$/
    self.__send__(:[]=, meth.to_s.gsub(/=$/,'').intern, *args)
  else
    self.__send__(:[], meth, *args)
  end
end

Instance Method Details

#methods(regular = true) ⇒ Object



77
78
79
# File 'lib/ragweed.rb', line 77

def methods regular=true
  (super + self.members.map{|x| [x.to_s, x.to_s+"="]}).flatten
end

#respond_to?(meth, include_priv = false) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
98
# File 'lib/ragweed.rb', line 95

def respond_to? meth, include_priv=false
  # mth = meth.to_s.gsub(/=$/,'')
  !((self.methods & [meth, meth.to_s]).empty?) || super
end