Sha256: 279353ac47bcfbc6dbed0fa15b300f7d9fa7cd95db0be58bc0cf73b12ce80eee
Contents?: true
Size: 411 Bytes
Versions: 3
Compression:
Stored size: 411 Bytes
Contents
module RiceBubble class Attributes class Integer < Number attr_reader :min, :max def valid?(value) value.is_a?(::Integer) && super end def coerce(value) case value when nil then nil when ::String then value.match?(/\A-?\d+\z/) ? value.to_i : value else value.respond_to?(:to_i) ? value.to_i : value end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rice_bubble-0.1.2 | lib/rice_bubble/attributes/integer.rb |
rice_bubble-0.1.1 | lib/rice_bubble/attributes/integer.rb |
rice_bubble-0.1.0 | lib/rice_bubble/attributes/integer.rb |