Class: Boxes::Template::ERBContext
- Inherits:
-
Object
- Object
- Boxes::Template::ERBContext
- Defined in:
- lib/boxes/template.rb
Overview
A context to render inside, to avoid polluting other classes.
Instance Method Summary collapse
-
#get_binding ⇒ Object
The binding which is passed to ERB.
-
#initialize(args = {}) ⇒ ERBContext
constructor
Create a new context with a given hash of values.
Constructor Details
#initialize(args = {}) ⇒ ERBContext
Create a new context with a given hash of values.
38 39 40 41 42 |
# File 'lib/boxes/template.rb', line 38 def initialize(args = {}) args.each_pair do |k, v| instance_variable_set('@' + k.to_s, v) end end |
Instance Method Details
#get_binding ⇒ Object
The binding which is passed to ERB.
45 46 47 |
# File 'lib/boxes/template.rb', line 45 def get_binding # rubocop:disable Style/AccessorMethodName binding end |