Module: Cuba::With

Defined in:
lib/cuba/with.rb

Instance Method Summary collapse

Instance Method Details

#varsObject



10
11
12
# File 'lib/cuba/with.rb', line 10

def vars
  env["cuba.vars"] ||= {}
end

#with(dict = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/cuba/with.rb', line 3

def with(dict = {})
  old, env["cuba.vars"] = vars, vars.merge(dict)
  yield
ensure
  env["cuba.vars"] = old
end