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



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

def initialize(dirs)
  @dirs = dirs
end

Instance Method Details

#apply(xml) ⇒ Object

Apply them to the XML.



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

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