Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created August 17, 2016 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/babf8b848aeb2562374d28ec48830d9a to your computer and use it in GitHub Desktop.
Save anonymous/babf8b848aeb2562374d28ec48830d9a to your computer and use it in GitHub Desktop.
class Report
include ERB::Util
attr_reader :everthing, :template
def initialize(args)
serial = SERIAL
output_file = args[:output_file] or raise ArgumentError, 'Failed to specify the output pdf file in arguments.'
@tmpl_file = args[:template] or raise ArgumentError, 'Failed to specify the template to use for rendering.'
@everything = Target::GatherData.new(serial).aggregated
end
def render
template = File.read(@tmpl_file).chomp
layout = ERB.new(template, 0, '')
layout.result(binding) # always get NoMethodError: undefined method `[]' for nil:NilClass
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment