Sha256: 183d44e2e06264614811c8d1dd14ddaf1299f31a30663cc190c8d7e7ab2c45b5

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

# encoding: utf-8

module TTY
  class Coercer
    # Coerce value into integer number
    #
    # @api public
    class Integer
      def self.coerce(value, strict = true)
        Kernel.send(:Integer, value.to_s)
      rescue
        if strict
          raise InvalidArgument, "#{value} could not be coerced into Integer"
        else
          value.to_i
        end
      end
    end # Integer
  end # Coercer
end # TTY

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-0.1.0 lib/tty/coercer/integer.rb