Class: Restspec::Schema::Types::DecimalType
- Defined in:
- lib/restspec/schema/types/decimal_type.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from BasicType
#initialize, #of, #totally_valid?, #|
Constructor Details
This class inherits a constructor from Restspec::Schema::Types::BasicType
Instance Method Details
#example_for(attribute) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/restspec/schema/types/decimal_type.rb', line 3 def example_for(attribute) integer_part = .fetch(:integer_part, 2) decimal_part = .fetch(:decimal_part, 2) Faker::Number.decimal(integer_part, decimal_part) end |
#valid?(attribute, value) ⇒ Boolean
10 11 12 |
# File 'lib/restspec/schema/types/decimal_type.rb', line 10 def valid?(attribute, value) value.is_a?(Numeric) end |