Class: L10nizer::Processor

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

Instance Method Summary collapse

Constructor Details

#initialize(html, keygen) ⇒ Processor

Returns a new instance of Processor.



6
7
8
9
# File 'lib/l10nizer/processor.rb', line 6

def initialize(html, keygen)
  @html = html
  @keygen = keygen
end

Instance Method Details

#l10nsObject



11
12
13
# File 'lib/l10nizer/processor.rb', line 11

def l10ns
  processed.inject({}){ |hash, node| hash.merge(node.l10n) }
end

#processedObject



19
20
21
22
23
24
25
# File 'lib/l10nizer/processor.rb', line 19

def processed
  @processed ||=
    HtmlErbParser.new.
    parse(@html).
    elements.
    map{ |e| NodeWrapperFactory.wrap(e, @keygen) }
end

#reformedObject



15
16
17
# File 'lib/l10nizer/processor.rb', line 15

def reformed
  processed.map{ |e| e.to_s }.join
end