Module: Potter::Transformers
Instance Method Summary collapse
Instance Method Details
#initialize(value = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/potter/transformers.rb', line 5 def initialize(value = nil) self.class.transformers.each do |klass, block| if value.is_a? klass super(nil) value.instance_exec(self, &block) return end end super end |
#to(klass) ⇒ Object
17 |
# File 'lib/potter/transformers.rb', line 17 def to(klass) = klass.new(self) |