Class: XRuntime::Template
- Inherits:
-
Object
- Object
- XRuntime::Template
- Defined in:
- lib/x_runtime/template.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ds, opts = {}) ⇒ Template
constructor
A new instance of Template.
- #render ⇒ Object
Constructor Details
#initialize(ds, opts = {}) ⇒ Template
Returns a new instance of Template.
5 6 7 8 9 10 11 12 |
# File 'lib/x_runtime/template.rb', line 5 def initialize(ds, opts={}) opts.delete_if{|k,v| v == nil} opts = {:limit => 100, :offset => 0}.update(opts) @ds = ds @offset = opts[:offset] @limit = opts[:limit] @data = @ds.latest(:limit => opts[:limit], :offset => opts[:offset]) end |
Class Method Details
.erb ⇒ Object
18 19 20 |
# File 'lib/x_runtime/template.rb', line 18 def self.erb @erb ||= ERB.new(self.html) end |
.html ⇒ Object
22 23 24 |
# File 'lib/x_runtime/template.rb', line 22 def self.html @html ||= IO.read(File.join(File.dirname(__FILE__),'template.erb')) end |