Class: Potter::Transformer

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

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Transformer

Returns a new instance of Transformer.



3
4
5
6
# File 'lib/potter/transformer.rb', line 3

def initialize(klass)
  @klass   = klass
  @parsers = Hash.new { _1[_2] = [] }
end

Instance Method Details

#from(o) ⇒ Object



12
13
# File 'lib/potter/transformer.rb', line 12

def from(o)
end

#parse(type, &block) ⇒ Object



8
9
10
# File 'lib/potter/transformer.rb', line 8

def parse(type, &block)
  parsers[type] << block
end