Module: Toy::Extensions::Integer
- Included in:
- Integer
- Defined in:
- lib/toy/extensions/integer.rb
Instance Method Summary collapse
Instance Method Details
#from_store(value) ⇒ Object
13 14 15 |
# File 'lib/toy/extensions/integer.rb', line 13 def from_store(value, *) to_store(value) end |
#to_store(value) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/toy/extensions/integer.rb', line 4 def to_store(value, *) value_to_i = value.to_i if value_to_i == 0 && value != value_to_i value.to_s =~ /^(0x|0b)?0+/ ? 0 : nil else value_to_i end end |