Class: HooplaSalesforce::TemplateProcessor::Base
- Inherits:
-
Object
- Object
- HooplaSalesforce::TemplateProcessor::Base
- Includes:
- CaptureHelper
- Defined in:
- lib/hoopla_salesforce/template_processor.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Instance Method Summary collapse
- #each_resource_file(files, extension) ⇒ Object
-
#initialize(src, file) ⇒ Base
constructor
A new instance of Base.
Methods included from CaptureHelper
Constructor Details
#initialize(src, file) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hoopla_salesforce/template_processor.rb', line 9 def initialize(src, file) @src = src @base = File.basename(file, '.erb') @file = file template = Eruby.new(File.read(file)) File.open(output_file, 'w') do |f| f.print template.result(binding) end end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
8 9 10 |
# File 'lib/hoopla_salesforce/template_processor.rb', line 8 def base @base end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
8 9 10 |
# File 'lib/hoopla_salesforce/template_processor.rb', line 8 def file @file end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
8 9 10 |
# File 'lib/hoopla_salesforce/template_processor.rb', line 8 def src @src end |
Instance Method Details
#each_resource_file(files, extension) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/hoopla_salesforce/template_processor.rb', line 20 def each_resource_file(files, extension) files.map do |file| # FIXME, this added .js on a .js file file += ".#{extension}" unless extension =~ /\.#{extension}$/ yield file end.join("\n") end |