Class: EacRubyUtils::ByteArray

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/byte_array.rb

Instance Method Summary collapse

Constructor Details

#initialize(values = []) ⇒ ByteArray

Returns a new instance of ByteArray.



11
12
13
# File 'lib/eac_ruby_utils/byte_array.rb', line 11

def initialize(values = [])
  values.each { |value| push(value) }
end

Instance Method Details

#<<(value) ⇒ Object



15
16
17
# File 'lib/eac_ruby_utils/byte_array.rb', line 15

def <<(value)
  push(value)
end

#push(value) ⇒ EacRubyUtils::Byte

Parameters:

Returns:



21
22
23
# File 'lib/eac_ruby_utils/byte_array.rb', line 21

def push(value)
  values_array.push(::EacRubyUtils::Byte.assert(value))
end

#to_int_arrayArray<Integer>

Returns:

  • (Array<Integer>)


26
27
28
# File 'lib/eac_ruby_utils/byte_array.rb', line 26

def to_int_array
  values_array.map(&:to_i)
end