class Multibases::EncodedByteArray
Public Instance Methods
chomp!(ord)
click to toggle source
# File lib/multibases/byte_array.rb, line 57 def chomp!(ord) return self unless ord __getobj__.reverse! index = __getobj__.find_index { |el| el != ord } __getobj__.slice!(0, index) unless index.nil? __getobj__.reverse! self end
inspect()
click to toggle source
# File lib/multibases/byte_array.rb, line 38 def inspect encoding = @encoding || Encoding::BINARY "[Multibases::EncodedByteArray \"#{to_str(encoding)}\"]" end
to_ascii_str()
click to toggle source
# File lib/multibases/byte_array.rb, line 49 def to_ascii_str to_str(Encoding::US_ASCII) end
to_str(encoding = @encoding)
click to toggle source
# File lib/multibases/byte_array.rb, line 43 def to_str(encoding = @encoding) raise MissingEncoding unless encoding pack('C*').force_encoding(encoding) end
Also aliased as: to_s
to_utf8_str()
click to toggle source
# File lib/multibases/byte_array.rb, line 53 def to_utf8_str to_str(Encoding::UTF_8) end