Class: SBFToolkit::Component
- Inherits:
-
Object
- Object
- SBFToolkit::Component
show all
- Defined in:
- lib/sbf_toolkit/component.rb
Constant Summary
collapse
- TEMPLATE_ROOT =
'../../../src/templates'.freeze
- IMAGE_EXTENSIONS =
%w(png jpg jpeg).freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.render(data = {}) ⇒ Object
14
15
16
17
18
|
# File 'lib/sbf_toolkit/component.rb', line 14
def render(data = {})
load_template
rendered = renderer.render(@template, data)
ActiveSupport::SafeBuffer.new(rendered)
end
|
.template(path) ⇒ Object
10
11
12
|
# File 'lib/sbf_toolkit/component.rb', line 10
def template(path)
@template_path ||= File.expand_path(File.join(TEMPLATE_ROOT, path), __FILE__)
end
|
Instance Method Details
#render(data = {}) ⇒ Object
67
68
69
|
# File 'lib/sbf_toolkit/component.rb', line 67
def render(data = {})
self.class.render(data)
end
|