Module: Brcobranca::Currency::String
- Defined in:
- lib/brcobranca/currency.rb
Overview
Instance Method Summary collapse
Instance Method Details
#numeric? ⇒ Boolean
16 17 18 |
# File 'lib/brcobranca/currency.rb', line 16 def numeric? self =~ /^(\+|-)?[0-9]+((\.|,)[0-9]+)?$/ ? true : false end |
#to_number(options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/brcobranca/currency.rb', line 11 def to_number(={}) return self.gsub(/,/, '.').to_f if self.numeric? nil end |