class Epuber::GlobalsContext

Attributes

catch_variables[RW]

Public Class Methods

new() click to toggle source
# File lib/epuber/vendor/globals_context.rb, line 6
def initialize
  @catch_variables = []
end

Public Instance Methods

catch() { || ... } click to toggle source
# File lib/epuber/vendor/globals_context.rb, line 10
def catch
  before = global_variables

  begin
    yield
  ensure
    @catch_variables += (global_variables - before)
  end
end
clear_all() click to toggle source
# File lib/epuber/vendor/globals_context.rb, line 20
def clear_all
  @catch_variables.each do |name|
    eval("#{name} = nil")
  end
end