class Xembly::Xembler

Xembler

Public Class Methods

new(dirs) click to toggle source

Ctor.

dirs

Directives

# File lib/xembly/xembler.rb, line 31
def initialize(dirs)
  @dirs = dirs
end

Public Instance Methods

apply(xml) click to toggle source

Apply them to the XML.

# 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