Class: Camille::Types::Number
- Defined in:
- lib/camille/types/number.rb
Instance Attribute Summary
Attributes inherited from BasicType
Instance Method Summary collapse
Methods inherited from BasicType
&, #&, [], #[], directly_instantiable?, inherited, #initialize, instance, #transform, |, #|
Constructor Details
This class inherits a constructor from Camille::BasicType
Instance Method Details
#check(value) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/camille/types/number.rb', line 4 def check value if value.is_a?(Integer) || value.is_a?(Float) Camille::Checked.new(fingerprint, value) else Camille::TypeError.new("Expected an integer or a float, got #{value.inspect}.") end end |
#literal ⇒ Object
12 13 14 |
# File 'lib/camille/types/number.rb', line 12 def literal "number" end |