class BareTypes::DataFixedLen

Public Class Methods

new(length) click to toggle source
# File lib/types.rb, line 263
def initialize(length)
  raise MinimumSizeError("DataFixedLen must have a length greater than 0, got: #{length.inspect}") if length < 1
  @length = length
end

Public Instance Methods

==(otherType) click to toggle source
# File lib/types.rb, line 252
def ==(otherType)
  return otherType.class == BareTypes::DataFixedLen && otherType.length == self.length
end
decode(msg) click to toggle source
# File lib/types.rb, line 275
def decode(msg)
  return msg[0..@length], msg[@length..msg.size]
end
encode(msg) click to toggle source
# File lib/types.rb, line 268
def encode(msg)
  if msg.size != @length
    raise FixedDataSizeWrong.new("Message is not proper sized for DataFixedLen should have been #{@length} but was #{msg.size}")
  end
  msg
end
finalize_references(schema) click to toggle source
# File lib/types.rb, line 260
def finalize_references(schema)
end
length() click to toggle source
# File lib/types.rb, line 256
def length
  return @length
end