Sha256: 7b406efff9a72a4cb8dec6be35018a0feab21f96e4cd4d4943ed0f262f732944

Contents?: true

Size: 363 Bytes

Versions: 30

Compression:

Stored size: 363 Bytes

Contents

module Gummi
  module DbLayer
    module Fields
      class PositiveInteger < Virtus::Attribute

        def coerce(value)
          coerced = value.to_i
          if coerced > 0
            coerced
          else
            default_value.value
          end
        end

        def mapping
          { type: 'integer' }
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
gummi-1.0.10 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.9 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.8 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.7 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.6 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.5 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.4 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.16 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.3 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.2 lib/gummi/db_layer/fields/positive_integer.rb
gummi-1.0.0 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.14 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.13 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.12 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.11 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.10 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.9 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.8 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.7 lib/gummi/db_layer/fields/positive_integer.rb
gummi-0.3.6 lib/gummi/db_layer/fields/positive_integer.rb