Sha256: 5376c5d225a1f64cf1f2b6f014138d1bd9087f191f20b231bfc26868ceb94074

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

class String
  # http://taro-tnk.hatenablog.com/entry/2012/12/17/001552

  # Return true if the 'str' express float, else return false.
  def self.float?(str)
    begin
      Float(str)
      true
    rescue ArgumentError
      false
    end
  end

  # Return true if the 'str' express float, else return false.
  def float?
    self.class.float?(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
builtinextension-0.1.4 lib/string/float.rb