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

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Data

Returns a new instance of Data.



33
34
35
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 33

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

Instance Method Details

#==(other) ⇒ Object



46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 46

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

#hexObject



42
43
44
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 42

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

#to_sObject Also known as: to_str



37
38
39
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 37

def to_s
  @value
end