Class: Xembly::Xembler

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

Overview

Xembler

Instance Method Summary collapse

Constructor Details

#initialize(dirs) ⇒ Xembler

Ctor.

dirs

Directives



30
31
32
# File 'lib/xembly/xembler.rb', line 30

def initialize(dirs)
  @dirs = dirs
end

Instance Method Details

#apply(xml) ⇒ Object

Apply them to the XML.



35
36
37
38
39
40
41
42
43
# File 'lib/xembly/xembler.rb', line 35

def apply(xml)
  dom = Nokogiri::XML(xml)
  cursor = [dom]
  @dirs.each do |dir|
    cursor = dir.exec(dom, cursor)
  end
  Xembly.log.info "#{@dirs.length} directive(s) applied"
  dom
end