Class: Rstruct::PackedType

Inherits:
Type
  • Object
show all
Includes:
Packable
Defined in:
lib/rstruct/base_types/packed_type.rb

Instance Attribute Summary collapse

Attributes inherited from Type

#name, #params

Instance Method Summary collapse

Methods included from Packable

#pack_value, #read

Methods inherited from Type

#claim_value, #container?, #groupable?, #register

Constructor Details

#initialize(name, size, format, opts = {}, &block) ⇒ PackedType

Returns a new instance of PackedType.



66
67
68
69
70
71
# File 'lib/rstruct/base_types/packed_type.rb', line 66

def initialize(name, size, format, opts={}, &block)
  @sizeof = size
  @format = format
  @groupable = true
  super(name, opts, &block)
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



64
65
66
# File 'lib/rstruct/base_types/packed_type.rb', line 64

def format
  @format
end

#sizeofObject (readonly)

Returns the value of attribute sizeof.



64
65
66
# File 'lib/rstruct/base_types/packed_type.rb', line 64

def sizeof
  @sizeof
end

Instance Method Details

#instance(val = nil) ⇒ Object



73
74
75
# File 'lib/rstruct/base_types/packed_type.rb', line 73

def instance(val=nil)
  val
end