Class: Win32::CaptureIE::FFI::CStruct::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/win32/capture_ie/ffi/struct.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, size) ⇒ DSL

Returns a new instance of DSL.



233
234
235
# File 'lib/win32/capture_ie/ffi/struct.rb', line 233

def initialize(name, size)
  @struct = StructureType.new(name, size)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



237
238
239
240
241
242
# File 'lib/win32/capture_ie/ffi/struct.rb', line 237

def method_missing(name, *args)
  type = CStruct.c_type(name)
  raise "unknown type: #{name}" unless type
  name = args.shift
  @struct.fields << Field.new(type, name, *args)
end

Instance Attribute Details

#structObject (readonly)

Returns the value of attribute struct.



231
232
233
# File 'lib/win32/capture_ie/ffi/struct.rb', line 231

def struct
  @struct
end