Class: Bauk::Gen::Contents::BaseContent
- Inherits:
-
Object
- Object
- Bauk::Gen::Contents::BaseContent
- Includes:
- Utils::Log
- Defined in:
- lib/bauk/gen/contents/base_content.rb
Direct Known Subclasses
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(opts) ⇒ BaseContent
constructor
A new instance of BaseContent.
Constructor Details
#initialize(opts) ⇒ BaseContent
Returns a new instance of BaseContent.
11 12 13 14 |
# File 'lib/bauk/gen/contents/base_content.rb', line 11 def initialize(opts) @attributes = opts[:attributes] @config = opts[:config] end |
Instance Method Details
#content ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/bauk/gen/contents/base_content.rb', line 16 def content renderer = ERB.new(File.read(@file)) begin renderer.result(OpenStruct.new(@config).instance_eval { binding }) rescue => e log.error("ERROR IN FILE: #{@file}") throw e end end |