Module: EndView::ClassMethods

Defined in:
lib/end_view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#templateObject

Returns the value of attribute template.



34
35
36
# File 'lib/end_view.rb', line 34

def template
  @template
end

Instance Method Details

#compile_template(opts = {}) ⇒ Object



42
43
44
45
46
# File 'lib/end_view.rb', line 42

def compile_template(opts = {})
  file = opts[:file] || caller_file(opts[:start] || 3)
  template_engine = opts[:template_engine] || EndView.default_engine
  @template = template_engine.new(file) { data(file) }
end

#inherited(child) ⇒ Object



36
37
38
39
40
# File 'lib/end_view.rb', line 36

def inherited(child)
  super
  child.template = template
  child.layout(retrieve_layout)
end

#layout(layout) ⇒ Object



48
49
50
# File 'lib/end_view.rb', line 48

def layout(layout)
  @layout = layout
end

#retrieve_layoutObject



52
53
54
# File 'lib/end_view.rb', line 52

def retrieve_layout
  @layout
end