Class: Sinatra::JstPages::Engine
- Inherits:
-
Object
- Object
- Sinatra::JstPages::Engine
- Defined in:
- lib/furnace-xray/lib/jst_pages.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
### file [attribute] The string path of the template file.
Instance Method Summary collapse
-
#contents ⇒ Object
### contents [method] Returns the contents of the template file as a string.
-
#function ⇒ Object
### function [method] The JavaScript function to invoke on the precompile’d object.
-
#initialize(file) ⇒ Engine
constructor
A new instance of Engine.
Constructor Details
#initialize(file) ⇒ Engine
Returns a new instance of Engine.
181 182 183 |
# File 'lib/furnace-xray/lib/jst_pages.rb', line 181 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
### file [attribute] The string path of the template file.
180 181 182 |
# File 'lib/furnace-xray/lib/jst_pages.rb', line 180 def file @file end |
Instance Method Details
#contents ⇒ Object
### contents [method] Returns the contents of the template file as a string.
187 188 189 |
# File 'lib/furnace-xray/lib/jst_pages.rb', line 187 def contents File.read(@file) end |
#function ⇒ Object
### function [method] The JavaScript function to invoke on the precompile’d object.
What this returns should, in JavaScript, return a function that can be called with an object hash of the params to be passed onto the template.
196 197 198 |
# File 'lib/furnace-xray/lib/jst_pages.rb', line 196 def function "_.template(#{contents.inspect})" end |