Method: Arbo::Context#initialize

Defined in:
lib/arbo/context.rb

#initialize(assigns = {}, helpers = nil) { ... } ⇒ Context

Initialize a new Arbo::Context

Parameters:

  • assigns (Hash) (defaults to: {})

    A hash of objecs that you would like to be availble as local variables within the Context

  • helpers (Object) (defaults to: nil)

    An object that has methods on it which will become instance methods within the context.

Yields:

  • The block that will get instance eval’d in the context



38
39
40
41
42
43
44
45
46
47
# File 'lib/arbo/context.rb', line 38

def initialize(assigns = {}, helpers = nil, &block)
  assigns = assigns || {}
  @_assigns = assigns.symbolize_keys

  @_helpers = helpers
  @_current_arbo_element_buffer = [self]

  super(self)
  instance_eval(&block) if block_given?
end