Class: ActiveModel::Type::Binary::Data
- Inherits:
-
Object
- Object
- ActiveModel::Type::Binary::Data
- Defined in:
- lib/active_model/type/binary.rb
Overview
:nodoc:
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hex ⇒ Object
-
#initialize(value) ⇒ Data
constructor
A new instance of Data.
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(value) ⇒ Data
Returns a new instance of Data.
31 32 33 |
# File 'lib/active_model/type/binary.rb', line 31 def initialize(value) @value = value.to_s end |
Instance Method Details
#==(other) ⇒ Object
44 45 46 |
# File 'lib/active_model/type/binary.rb', line 44 def ==(other) other == to_s || super end |
#hex ⇒ Object
40 41 42 |
# File 'lib/active_model/type/binary.rb', line 40 def hex @value.unpack('H*')[0] end |
#to_s ⇒ Object Also known as: to_str
35 36 37 |
# File 'lib/active_model/type/binary.rb', line 35 def to_s @value end |