Class: Implicit

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

Instance Method Summary collapse

Instance Method Details

#from(starting_class) ⇒ Object

Set the base of the implicit wrapping. This should be an existing class.



19
20
21
22
23
# File 'lib/implicitly.rb', line 19

def from(starting_class)
  @starting_class = starting_class
  try_to_do_everything
  self
end

#to(ending_class) ⇒ Object

Set the wrapper class. This class must have a constructor which takes one argument, which is an instance of the base class.



27
28
29
30
31
# File 'lib/implicitly.rb', line 27

def to(ending_class)
  @ending_class = ending_class
  try_to_do_everything
  self
end

#via(&transformer) ⇒ Object

Set the transformer. This is a Proc which takes an instance of the base class and produces an instance of the wrapper class.



35
36
37
38
39
# File 'lib/implicitly.rb', line 35

def via(&transformer)
  @transformer = transformer
  try_to_do_everything
  self
end