Class: Wizard::Spells::CompileTemplate
- Defined in:
- lib/wizard/spells/compile_template.rb
Constant Summary
Constants included from Helpers
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Attributes inherited from MakeFile
Instance Method Summary collapse
-
#initialize(filename, template, options = {}) ⇒ CompileTemplate
constructor
A new instance of CompileTemplate.
- #perform_with_template_compilation ⇒ Object (also: #perform)
Methods inherited from MakeFile
#create_file!, #identical_content?
Methods inherited from Base
all_forced?, attr_status, #force!, force_all!, #force_all!, #forced?, #status, #status?
Methods included from Helpers
#adjust, #colorize, #console_width, #print, #say, #say!
Constructor Details
#initialize(filename, template, options = {}) ⇒ CompileTemplate
Returns a new instance of CompileTemplate.
10 11 12 13 |
# File 'lib/wizard/spells/compile_template.rb', line 10 def initialize(filename, template, ={}) super(filename, nil, ) @template = template end |
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
8 9 10 |
# File 'lib/wizard/spells/compile_template.rb', line 8 def template @template end |
Instance Method Details
#perform_with_template_compilation ⇒ Object Also known as: perform
15 16 17 18 19 20 |
# File 'lib/wizard/spells/compile_template.rb', line 15 def perform_with_template_compilation @content = ERB.new(File.read(template)).result(binding) perform_without_template_compilation rescue Object error! end |