Sha256: 448145a87d324b985b9e8ad0f58310f20aa125c64bd42be88b67d169e9f73510

Contents?: true

Size: 635 Bytes

Versions: 11

Compression:

Stored size: 635 Bytes

Contents

module Restspec::Schema::Types
  class IntegerType < BasicType
    # Generates a random number.
    #
    # @param attribute [Restspec::Schema::Attribute] the atribute of the schema.
    #
    # @return [Fixnum] A random number.
    def example_for(attribute)
      Faker::Number.digit.to_i
    end

    # 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.
    def valid?(attribute, value)
      value.is_a?(Fixnum)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
restspec-0.3.2 lib/restspec/schema/types/integer_type.rb
restspec-0.3.1 lib/restspec/schema/types/integer_type.rb
restspec-0.3.0 lib/restspec/schema/types/integer_type.rb
restspec-0.2.6 lib/restspec/schema/types/integer_type.rb
restspec-0.2.5 lib/restspec/schema/types/integer_type.rb
restspec-0.2.4 lib/restspec/schema/types/integer_type.rb
restspec-0.2.3 lib/restspec/schema/types/integer_type.rb
restspec-0.2.2 lib/restspec/schema/types/integer_type.rb
restspec-0.2.1 lib/restspec/schema/types/integer_type.rb
restspec-0.2 lib/restspec/schema/types/integer_type.rb
restspec-0.1 lib/restspec/schema/types/integer_type.rb