Sha256: 3807713a8078e42faa04feb9a21f14a1c3f892f2bb0abc04c1eb27c37125bc36

Contents?: true

Size: 371 Bytes

Versions: 1

Compression:

Stored size: 371 Bytes

Contents

require 'bigdecimal'
require 'bigdecimal/util'

module FeCoreExt::CoreExt
end

module FeCoreExt::CoreExt::String
  def to_integer
    return if not_number?
    delete(',').to_i
  end

  def to_decimal
    return if not_number?
    delete(',').to_d
  end

  def not_number?
    to_i == 0 && match('0').nil?
  end
end

class String
  include FeCoreExt::CoreExt::String
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fe_core_ext-0.1.2 lib/fe_core_ext/core_ext/string.rb