Class: KDL::Types::Decimal

Inherits:
Value
  • Object
show all
Defined in:
lib/kdl/types/decimal.rb

Constant Summary

Constants inherited from Value

Value::Null

Instance Attribute Summary

Attributes inherited from Value

#format, #type, #value

Class Method Summary collapse

Methods inherited from Value

#as_type, from, #initialize, #stringify_value, #to_s

Constructor Details

This class inherits a constructor from KDL::Value

Class Method Details

.call(value, type = 'decimal') ⇒ Object



4
5
6
7
8
9
# File 'lib/kdl/types/decimal.rb', line 4

def self.call(value, type = 'decimal')
  return nil unless value.is_a? ::KDL::Value::String

  big_decimal = BigDecimal(value.value)
  new(big_decimal, type: type)
end