Class: FFI::Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/roglew/ext/ffi_struct_ext.rb

Class Method Summary collapse

Class Method Details

.layout(*args) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/roglew/ext/ffi_struct_ext.rb', line 11

def self.layout(*args)
  layout_base(*args)
  members.each do |name|
    unless method_defined?(name)
      define_method name, ->{ self[name] }
      define_method "#{name}=", ->(v){ self[name] = v }
    end
  end
end

.layout_baseObject



6
# File 'lib/roglew/ext/ffi_struct_ext.rb', line 6

alias :layout_base :layout