Sha256: f7916134b41de23bfc319e96361ac14bc5c8876eed6740193e406720c69907e6
Contents?: true
Size: 648 Bytes
Versions: 2
Compression:
Stored size: 648 Bytes
Contents
# frozen_string_literal: true require_relative "base" class StoreSchema::Converter::Integer < StoreSchema::Converter::Base # @return [Regexp] the int value format. # INT_FORMAT = /^\d+$/ # Converts the {#value} to a database-storable value. # # @return [String, false] false if {#value} is an invalid date-type. # def to_db case value when ::Integer value.to_s when ::String if value.match(INT_FORMAT) value else false end else false end end # Converts the {#value} to a Ruby-type value. # # @return [Integer] # def from_db value.to_i end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
store_schema-2.0.0 | lib/store_schema/converter/integer.rb |
store_schema-1.1.1 | lib/store_schema/converter/integer.rb |