Module: Stellar::Erb
- Defined in:
- lib/stellar/erb.rb,
lib/stellar/erb/view.rb,
lib/stellar/erb/error.rb,
lib/stellar/erb/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.render(template_path, locals = {}) ⇒ String
Shortcut method for rendering templates This method provides a convenient interface to render ERB templates directly from the Stellar::Erb module without instantiating a View.
-
.render_string(str, locals = {}) ⇒ String
Renders an ERB template from a string instead of a file This is useful for template strings that are generated dynamically or stored in a database rather than in files.
Class Method Details
.render(template_path, locals = {}) ⇒ String
Shortcut method for rendering templates This method provides a convenient interface to render ERB templates directly from the Stellar::Erb module without instantiating a View.
30 31 32 |
# File 'lib/stellar/erb.rb', line 30 def self.render(template_path, locals = {}) View.render(template_path, locals) end |
.render_string(str, locals = {}) ⇒ String
Renders an ERB template from a string instead of a file This is useful for template strings that are generated dynamically or stored in a database rather than in files.
49 50 51 52 53 |
# File 'lib/stellar/erb.rb', line 49 def self.render_string(str, locals = {}) v = View.new(nil, locals) v.template_content = str v.render() end |