Class: Onebox::Layout
- Inherits:
-
Mustache
- Object
- Mustache
- Onebox::Layout
- Includes:
- TemplateSupport
- Defined in:
- lib/onebox/layout.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(name, record) ⇒ Layout
constructor
A new instance of Layout.
- #to_html ⇒ Object
Methods included from TemplateSupport
Constructor Details
#initialize(name, record) ⇒ Layout
Returns a new instance of Layout.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/onebox/layout.rb', line 14 def initialize(name, record) @record = Onebox::Helpers.symbolize_keys(record) # Fix any relative paths if @record[:image] && @record[:image] =~ /^\/[^\/]/ @record[:image] = "#{uri.scheme}://#{uri.host}/#{@record[:image]}" end @md5 = Digest::MD5.new @view = View.new(name, @record) @template_name = "_layout" @template_path = load_paths.last end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
11 12 13 |
# File 'lib/onebox/layout.rb', line 11 def record @record end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
12 13 14 |
# File 'lib/onebox/layout.rb', line 12 def view @view end |
Instance Method Details
#to_html ⇒ Object
28 29 30 |
# File 'lib/onebox/layout.rb', line 28 def to_html render(details) end |