Sha256: 431d24df863152b99224d87b986b3eca76c003e9cdf798aaac1c41f1f998ed21
Contents?: true
Size: 708 Bytes
Versions: 2
Compression:
Stored size: 708 Bytes
Contents
module Docxtor2 class TemplateParser class << self def parse(template) instance = new(template) instance.parts end end def initialize(template) @parts = parse(template) end def parts @parts end private def parse(template) Dir.chdir(template) do Hash[create_parts] end end def create_parts Dir[SEARCH_PATTERN]. delete_if { |file| File.directory?(file) }. map { |file| create_part(file) } end def create_part(file) content = File.read(file) part = Package::Part.new(file, content) key = File.basename(file, '.xml') [key, part] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
docxtor2-0.0.9 | lib/docxtor2/template_parser.rb |
docxtor2-0.1.0 | lib/docxtor2/template_parser.rb |