class Restspec::Schema::Types::IntegerType

Public Instance Methods

example_for(attribute) click to toggle source

Generates a random number.

@param attribute [Restspec::Schema::Attribute] the atribute of the schema.

@return [Fixnum] A random number.

# File lib/restspec/schema/types/integer_type.rb, line 8
def example_for(attribute)
  Faker::Number.digit.to_i
end
valid?(attribute, value) click to toggle source

Validates if the value is an integer (Fixnum).

@param attribute [Restspec::Schema::Attribute] the atribute of the schema. @param value [Object] the value of the attribute.

@return [true, false] If the value is an integer.

# File lib/restspec/schema/types/integer_type.rb, line 18
def valid?(attribute, value)
  value.is_a?(Fixnum)
end