Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/implicitly.rb
Instance Method Summary collapse
-
#implicitly ⇒ Object
Set up the implicit handling.
Instance Method Details
#implicitly ⇒ Object
Set up the implicit handling. Use the #from #to and #via methods to specify the full transformation. For example:
implicit.from(Fixnum).to(FixnumWithTime).via {|number| FixnumWithTime.new(number) }
Nothing takes effect until all three (#from #to and #via) are set.
The above implicit will transform a Fixnum instance into a FixnumWithTime wrapper, but only when you call a public instance method which is defined in FixnumWithTime.
12 13 14 |
# File 'lib/implicitly.rb', line 12 def implicitly Implicit.new end |