Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/implicitly.rb

Instance Method Summary collapse

Instance Method Details

#implicitlyObject

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