Platypus
_ ___
/ \ / \
\. |: cc|
(.|:,---,
(.|: \ c|
(. y-'
\ _ /
m m
DESCRIPTION
Platypus provides a generalized type conversion system, method overloading and psuedo-classes.
RELEASE NOTES
Please see HISTORY file.
SYNOPSIS
Type Conversion
"1234".to(Float) => 1234.0 (Float)
Time.from("6:30") => 1234.0 (Time)
Method Overloading
To overload a method use the #overload method to define new functionality based on a specified type interface.
class X
include Overloadable
def x
"hello"
end
sig Integer
def x(i)
i
end
sig String, String
def x(s1, s2)
[s1, s2]
end
end
Psuedo-Classes
class KiloType < Type
x % 1000 == 0
end
KiloType === 1000
KiloType === 2000
INSTALLATION
To install with RubyGems simply open a console and type:
$ gem install typecast
Site installation can be achieved with Setup.rb (gem install setup), then download the tarball package and type:
$ tar -xvzf typecast-1.0.0.tgz
$ cd typecast-1.0.0
$ sudo setup.rb all
Windows users use ‘ruby setup.rb all’.
COPYING
Copyright © 2010 Thomas Sawyer
This program is ditributed unser the terms of the Ruby license.
See LICENSE or COPYING file for details.
#– - mode: rdoc -