Class: Depix::Binary::Fields::InnerField

Inherits:
Field
  • Object
show all
Defined in:
lib/depix/binary/fields.rb

Overview

Wrapper for a contained structure

Instance Attribute Summary collapse

Attributes inherited from Field

#desc, #name, #req

Instance Method Summary collapse

Methods inherited from Field

#clean, #explain, #initialize

Constructor Details

This class inherits a constructor from Depix::Binary::Fields::Field

Instance Attribute Details

#castObject

Returns the value of attribute cast.



316
317
318
# File 'lib/depix/binary/fields.rb', line 316

def cast
  @cast
end

Instance Method Details

#consume!(stack) ⇒ Object



327
328
329
# File 'lib/depix/binary/fields.rb', line 327

def consume!(stack)
  cast.consume!(stack)
end

#lengthObject



319
320
321
# File 'lib/depix/binary/fields.rb', line 319

def length
  cast.length
end

#pack(value) ⇒ Object



340
341
342
# File 'lib/depix/binary/fields.rb', line 340

def pack(value)
  cast.pack(value)
end

#patternObject



323
324
325
# File 'lib/depix/binary/fields.rb', line 323

def pattern
  cast.pattern
end

#rtypeObject



331
332
333
# File 'lib/depix/binary/fields.rb', line 331

def rtype
  cast
end

#validate!(value) ⇒ Object



335
336
337
338
# File 'lib/depix/binary/fields.rb', line 335

def validate!(value)
  super(value)
  cast.validate!(value) if cast.respond_to?(:validate!) && (!value.nil? || req?)
end