Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/xommelier/core_ext/numeric.rb

Overview

© Alexander Semyonov, 2011—2013, MIT License # Author: Alexander Semyonov [email protected] #

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_xommelier(value) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/xommelier/core_ext/numeric.rb', line 9

def self.from_xommelier(value)
  return nil if value.blank?
  begin
    value.match?(/\./) ? Float(value) : Integer(value)
  rescue ArgumentError
    value
  end
end

Instance Method Details

#to_xommelierObject



18
19
20
# File 'lib/xommelier/core_ext/numeric.rb', line 18

def to_xommelier
  self
end