Class: TCOD::MethodStruct

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/libtcod/struct.rb

Overview

Wrapper for FFI::Struct which allows access of properties by method as well as indexing.

Class Method Summary collapse

Class Method Details

.layout(*keys) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/libtcod/struct.rb', line 9

def layout(*keys)
  old_layout(*keys)
  keys.each_slice(2).each do |key,type|
    define_method(key) do
      self[key]
    end
  end
end

.old_layoutObject



7
# File 'lib/libtcod/struct.rb', line 7

alias_method :old_layout, :layout