class Efail::Renderer
Public Class Methods
new(options)
click to toggle source
# File lib/efail/renderer.rb, line 5 def initialize options @dest = options[:dest] @force = options[:force_overwrite] @document = ::Roadie::Document.new File.open(options[:src]).read @document.url_options = { host: options[:url].host, protocol: options[:url].scheme } unless options[:url].nil? end
Public Instance Methods
render()
click to toggle source
# File lib/efail/renderer.rb, line 12 def render if !@force && (File.exists? (File.expand_path @dest)) puts "#{@dest} already exists. Overwrite with the --force flag." exit end file = File.new @dest, 'w' file.write @document.transform file.close end