Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
a ruby library full of common cast/coercion operations
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
pkg
README
Rakefile
coerce.gemspec

README

NAME
  coerce

DESCRIPTION
  a ruby library full of common cast/coercion operations

INSTALL
  gem install coerce

USAGE

  :~/git/coerce $ irb -r lib/coerce.rb 

  ruby-1.8.7-p330 :001 > Coerce.integer('42')
   => 42

  ruby-1.8.7-p330 :002 > Coerce.number('42.0')
   => 42.0 

  ruby-1.8.7-p330 :003 > Coerce.time('yesterday')
   => Wed Aug 24 12:00:00 -0600 2011 

  ruby-1.8.7-p330 :004 > Coerce.list_of_times('yesterday, today')
   => [Wed Aug 24 12:00:00 -0600 2011, Thu Aug 25 19:30:00 -0600 2011] 

  ruby-1.8.7-p330 :005 > Coerce.list_of_floats("42, 4.2\n\n 420")
   => [42.0, 4.2, 420.0] 
  
Something went wrong with that request. Please try again.