Class: Restspec::Schema::Types::IntegerType
- Defined in:
- lib/restspec/schema/types/integer_type.rb
Instance Method Summary collapse
-
#example_for(attribute) ⇒ Fixnum
Generates a random number.
-
#valid?(attribute, value) ⇒ true, false
Validates if the value is an integer (Fixnum).
Methods inherited from BasicType
#initialize, #of, #to_s, #totally_valid?, #|
Constructor Details
This class inherits a constructor from Restspec::Schema::Types::BasicType
Instance Method Details
#example_for(attribute) ⇒ Fixnum
Generates a random number.
8 9 10 |
# File 'lib/restspec/schema/types/integer_type.rb', line 8 def example_for(attribute) Faker::Number.digit.to_i end |
#valid?(attribute, value) ⇒ true, false
Validates if the value is an integer (Fixnum).
18 19 20 |
# File 'lib/restspec/schema/types/integer_type.rb', line 18 def valid?(attribute, value) value.is_a?(Fixnum) end |