Sha256: f473a135d7e1b8189bd8053ba199e592d7f13719389386081ed79b323046ce01

Contents?: true

Size: 612 Bytes

Versions: 4

Compression:

Stored size: 612 Bytes

Contents

module Ragweed::FFIStructInclude
  if RUBY_VERSION < "1.9"
    def methods regular=true
      super + self.offsets.map{|x| x.first.to_s}
    end
  else
    def methods regular=true
      super + self.offsets.map{|x| x.first}
    end
  end

  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

  def respond_to? meth, include_priv=false
    mth = meth.to_s.gsub(/=$/,'')
    self.offsets.map{|x| x.first.to_s}.include? mth || super
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ragweed-0.2.0.pre2-java lib/ragweed/wraptux/struct_helpers.rb
ragweed-0.2.0.pre2 lib/ragweed/wraptux/struct_helpers.rb
ragweed-0.2.0.pre1-java lib/ragweed/wraptux/struct_helpers.rb
ragweed-0.2.0.pre1 lib/ragweed/wraptux/struct_helpers.rb