Sha256: a76c476385cdf89b94aab647a895d28f70761e72998be80a0400a755cba3e29b

Contents?: true

Size: 360 Bytes

Versions: 4

Compression:

Stored size: 360 Bytes

Contents

module Restspec::Schema::Types
  class DecimalType < BasicType
    def example_for(attribute)
      integer_part = example_options.fetch(:integer_part, 2)
      decimal_part = example_options.fetch(:decimal_part, 2)

      Faker::Number.decimal(integer_part, decimal_part)
    end

    def valid?(attribute, value)
      value.is_a?(Numeric)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restspec-0.0.4 lib/restspec/schema/types/decimal_type.rb
restspec-0.0.3 lib/restspec/schema/types/decimal_type.rb
restspec-0.0.2 lib/restspec/schema/types/decimal_type.rb
restspec-0.0.1 lib/restspec/schema/types/decimal_type.rb