class SmsBackupRenderer::BasePage
Attributes
assets_dir_path[R]
Returns the String path to the folder where static assets have been copied to.
output_file_path[R]
Returns the String path to where this file will be written.
Public Class Methods
new(output_file_path, assets_dir_path)
click to toggle source
# File lib/sms_backup_renderer/renderer.rb, line 13 def initialize(output_file_path, assets_dir_path) @output_file_path = output_file_path @assets_dir_path = assets_dir_path end
Public Instance Methods
asset_path(filename)
click to toggle source
# File lib/sms_backup_renderer/renderer.rb, line 30 def asset_path(filename) Pathname.new(File.join(assets_dir_path, filename)) .relative_path_from(Pathname.new(File.dirname(output_file_path))).to_s end
relative_path(path)
click to toggle source
# File lib/sms_backup_renderer/renderer.rb, line 26 def relative_path(path) Pathname.new(path).relative_path_from(Pathname.new(File.dirname(output_file_path))).to_s end
render()
click to toggle source
# File lib/sms_backup_renderer/renderer.rb, line 18 def render ERB.new(File.read(File.join(File.dirname(__FILE__), 'templates', template_name))).result(binding) end
template_name()
click to toggle source
# File lib/sms_backup_renderer/renderer.rb, line 35 def template_name raise 'not implemented' end
write()
click to toggle source
# File lib/sms_backup_renderer/renderer.rb, line 22 def write File.write(output_file_path, render) end