class Flowcation::Partial
Attributes
path[R]
Public Class Methods
from_config(options={})
click to toggle source
# File lib/flowcation/partial.rb, line 17 def self.from_config(options={}) doc = Nokogiri::HTML(File.new(options['file'])).xpath("//body").xpath(options['xpath']) doc = doc[0].children if options['type'] == 'content' partial = Flowcation::Partial.new \ doc, options['path'], options['substitutions'] end
new(doc, path, substitutions)
click to toggle source
# File lib/flowcation/partial.rb, line 5 def initialize(doc, path, substitutions) @doc = doc @path = path @substitutions = substitutions || [] end
Public Instance Methods
content()
click to toggle source
# File lib/flowcation/partial.rb, line 11 def content doc = @doc.dup substitute(doc) Render.sanitize(doc.to_html(encoding: 'UTF-8')) end