Class: Embarista::DynamicIndex::Generator
- Inherits:
-
Object
- Object
- Embarista::DynamicIndex::Generator
- Defined in:
- lib/embarista/dynamic_index/generator.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#erb_path ⇒ Object
readonly
Returns the value of attribute erb_path.
Class Method Summary collapse
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(erb_path, context) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(erb_path, context) ⇒ Generator
Returns a new instance of Generator.
6 7 8 9 |
# File 'lib/embarista/dynamic_index/generator.rb', line 6 def initialize(erb_path, context) @erb_path = erb_path @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/embarista/dynamic_index/generator.rb', line 4 def context @context end |
#erb_path ⇒ Object (readonly)
Returns the value of attribute erb_path.
4 5 6 |
# File 'lib/embarista/dynamic_index/generator.rb', line 4 def erb_path @erb_path end |
Class Method Details
.generator(erb_path, manifest_id, assets_base_url = App.assets_base_url) ⇒ Object
21 22 23 24 |
# File 'lib/embarista/dynamic_index/generator.rb', line 21 def self.generator(erb_path, manifest_id, assets_base_url=App.assets_base_url) context = Context.context(manifest_id, assets_base_url) self.new(erb_path, context) end |
Instance Method Details
#html ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/embarista/dynamic_index/generator.rb', line 11 def html File.open(erb_path, 'r:UTF-8') do |f| erb = ERB.new(f.read, nil, '-') erb.filename = erb_path context.instance_eval do erb.result(binding) end end end |