Class: EacRubyUtils::Context
Instance Method Summary collapse
Instance Method Details
#current ⇒ Object
5 6 7 |
# File 'lib/eac_ruby_utils/context.rb', line 5 def current optional_current || raise('No elements in context') end |
#on(obj) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/eac_ruby_utils/context.rb', line 16 def on(obj) push(obj) begin yield ensure pop end end |
#optional_current ⇒ Object
9 10 11 |
# File 'lib/eac_ruby_utils/context.rb', line 9 def optional_current stack.last end |