Class: UseContext::ContextStack
- Inherits:
-
Object
- Object
- UseContext::ContextStack
- Defined in:
- lib/use_context.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize ⇒ ContextStack
constructor
A new instance of ContextStack.
- #pop ⇒ Object
- #push(context_hash) ⇒ Object
Constructor Details
#initialize ⇒ ContextStack
Returns a new instance of ContextStack.
45 46 47 48 |
# File 'lib/use_context.rb', line 45 def initialize @stack = [] @context = Context.new(@stack) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
43 44 45 |
# File 'lib/use_context.rb', line 43 def context @context end |
Instance Method Details
#pop ⇒ Object
54 55 56 |
# File 'lib/use_context.rb', line 54 def pop @stack.pop end |
#push(context_hash) ⇒ Object
50 51 52 |
# File 'lib/use_context.rb', line 50 def push(context_hash) @stack << context_hash end |