Sha256: 93a7bb15a1087d0c035aec53f40c1e688a010a927ad5f655ff5050c7c5c742bc

Contents?: true

Size: 324 Bytes

Versions: 5

Compression:

Stored size: 324 Bytes

Contents

class DecimalField < Field
  def numeric?
    true
  end
  
  def typecast(value, record)
    BigDecimal.new(value.to_s)
  end
  
  def untypecast(value, record)
    BigDecimal.new(value.to_s).to_s
  end
  
  def from_json(value, record)
    BigDecimal.new(value.to_s).to_s
  end
end

Field::TYPES['decimal'] = DecimalField

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/core/fields/decimal_field.rb
yodel-0.0.4 lib/yodel/models/core/fields/decimal_field.rb
yodel-0.0.3 lib/yodel/models/core/fields/decimal_field.rb
yodel-0.0.2 lib/yodel/models/core/fields/decimal_field.rb
yodel-0.0.1 lib/yodel/models/core/fields/decimal_field.rb