Class: HooplaSalesforce::TemplateProcessor::Base

Inherits:
Object
  • Object
show all
Includes:
CaptureHelper
Defined in:
lib/hoopla_salesforce/template_processor.rb

Direct Known Subclasses

Generic, TestPage, VisualForce

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CaptureHelper

#capture

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

#baseObject (readonly)

Returns the value of attribute base.



8
9
10
# File 'lib/hoopla_salesforce/template_processor.rb', line 8

def base
  @base
end

#fileObject (readonly)

Returns the value of attribute file.



8
9
10
# File 'lib/hoopla_salesforce/template_processor.rb', line 8

def file
  @file
end

#srcObject (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