Sha256: a2f54931768febf389ff95380d8183edeac45abb978a319c0b83146dea1f4a78

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

################################################
# © Alexander Semyonov, 2011—2013, MIT License #
# Author: Alexander Semyonov <al@semyonov.us>  #
################################################

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

  def to_xommelier
    self
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xommelier-0.1.35 lib/xommelier/core_ext/numeric.rb