123456789_123456789_123456789_123456789_123456789_

Class: ActiveModel::Type::Binary::Data

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activemodel/lib/active_model/type/binary.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(value) ⇒ Data

[ GitHub ]

  
# File 'activemodel/lib/active_model/type/binary.rb', line 41

def initialize(value)
  value = value.to_s
  value = value.b unless value.encoding == Encoding::BINARY
  @value = value
end

Instance Method Details

#==(other)

[ GitHub ]

  
# File 'activemodel/lib/active_model/type/binary.rb', line 56

def ==(other)
  other == to_s || super
end

#hex

[ GitHub ]

  
# File 'activemodel/lib/active_model/type/binary.rb', line 52

def hex
  @value.unpack1("H*")
end

#to_s Also known as: #to_str

[ GitHub ]

  
# File 'activemodel/lib/active_model/type/binary.rb', line 47

def to_s
  @value
end

#to_str

Alias for #to_s.

[ GitHub ]

  
# File 'activemodel/lib/active_model/type/binary.rb', line 50

alias_method :to_str, :to_s