Class: ActiveRecord::Type::Binary::Data

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/type/binary.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Data

Returns a new instance of Data.


31
32
33
# File 'activerecord/lib/active_record/type/binary.rb', line 31

def initialize(value)
  @value = value.to_s
end

Instance Method Details

#==(other) ⇒ Object


44
45
46
# File 'activerecord/lib/active_record/type/binary.rb', line 44

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

#hexObject


40
41
42
# File 'activerecord/lib/active_record/type/binary.rb', line 40

def hex
  @value.unpack('H*')[0]
end

#to_sObject Also known as: to_str


35
36
37
# File 'activerecord/lib/active_record/type/binary.rb', line 35

def to_s
  @value
end