class Multibases::ByteArray
Public Class Methods
new(array, encoding: nil)
click to toggle source
Calls superclass method
# File lib/multibases/byte_array.rb, line 8 def initialize(array, encoding: nil) super array @encoding = encoding end
Public Instance Methods
hash()
click to toggle source
# File lib/multibases/byte_array.rb, line 14 def hash __getobj__.hash end
is_a?(klazz)
click to toggle source
Calls superclass method
# File lib/multibases/byte_array.rb, line 22 def is_a?(klazz) super || __getobj__.is_a?(klazz) end
Also aliased as: kind_of?
to_arr()
click to toggle source
# File lib/multibases/byte_array.rb, line 18 def to_arr __getobj__.dup end
Also aliased as: to_a
transcode(from, to, encoding: nil)
click to toggle source
# File lib/multibases/byte_array.rb, line 26 def transcode(from, to, encoding: nil) from = from.each_with_index.to_h to = Hash[to.each_with_index.to_a.collect(&:reverse)] self.class.new(map { |byte| to[from[byte]] }, encoding: encoding) end