class EacRubyUtils::Context

Public Instance Methods

current() click to toggle source
# File lib/eac_ruby_utils/context.rb, line 5
def current
  optional_current || raise('No elements in context')
end
on(obj) { || ... } click to toggle source
# File lib/eac_ruby_utils/context.rb, line 16
def on(obj)
  push(obj)
  begin
    yield
  ensure
    pop
  end
end
optional_current() click to toggle source
# File lib/eac_ruby_utils/context.rb, line 9
def optional_current
  stack.last
end

Private Instance Methods

stack() click to toggle source
# File lib/eac_ruby_utils/context.rb, line 27
def stack
  @stack ||= []
end