Class: ActiveModel::Type::Binary::Data
- Defined in:
- activemodel/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.
37 38 39 |
# File 'activemodel/lib/active_model/type/binary.rb', line 37 def initialize(value) @value = value.to_s end |
Instance Method Details
#==(other) ⇒ Object
50 51 52 |
# File 'activemodel/lib/active_model/type/binary.rb', line 50 def ==(other) other == to_s || super end |
#hex ⇒ Object
46 47 48 |
# File 'activemodel/lib/active_model/type/binary.rb', line 46 def hex @value.unpack1("H*") end |
#to_s ⇒ Object Also known as: to_str
41 42 43 |
# File 'activemodel/lib/active_model/type/binary.rb', line 41 def to_s @value end |