Class: BigDecimal

Inherits:
Numeric
  • Object
show all
Defined in:
lib/sequel_opal_patches.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(v, _precision = nil) ⇒ Object



123
124
125
# File 'lib/sequel_opal_patches.rb', line 123

def self.new(v, _precision = nil)
  new_from(v)
end

.new_from(v) ⇒ Object



127
128
129
130
131
# File 'lib/sequel_opal_patches.rb', line 127

def self.new_from(v)
  alloc = allocate
  alloc.instance_variable_set(:@v, v.to_f)
  alloc
end

Instance Method Details

#==(other) ⇒ Object



141
142
143
# File 'lib/sequel_opal_patches.rb', line 141

def ==(other)
  other.respond_to?(:to_f) && to_f == other.to_f
end

#to_fObject



133
134
135
# File 'lib/sequel_opal_patches.rb', line 133

def to_f
  @v
end

#to_sObject



137
138
139
# File 'lib/sequel_opal_patches.rb', line 137

def to_s(*)
  @v.to_s
end