Class: Boxes::Template::ERBContext

Inherits:
Object
  • Object
show all
Defined in:
lib/boxes/template.rb

Overview

A context to render inside, to avoid polluting other classes.

Instance Method Summary collapse

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_bindingObject

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