Class: Contextify::PendingContext
- Inherits:
-
Object
- Object
- Contextify::PendingContext
- Includes:
- Enumerable
- Defined in:
- lib/contextify/pending_context.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
The blocks to be loaded.
-
#path ⇒ Object
readonly
The path being loaded.
Instance Method Summary collapse
-
#each {|name, block| ... } ⇒ Object
Iterates over each context name and block in the pending context.
-
#each_block {|block| ... } ⇒ Object
Iterates over each block in the pending context.
-
#each_class {|name| ... } ⇒ Object
Iterates over each context name in the pending context.
-
#initialize(path) ⇒ PendingContext
constructor
Creates a new PendingContext object.
Constructor Details
#initialize(path) ⇒ PendingContext
Creates a new PendingContext object.
18 19 20 21 |
# File 'lib/contextify/pending_context.rb', line 18 def initialize(path) @path = File.(path) @blocks = {} end |
Instance Attribute Details
#blocks ⇒ Object
The blocks to be loaded
10 11 12 |
# File 'lib/contextify/pending_context.rb', line 10 def blocks @blocks end |
#path ⇒ Object (readonly)
The path being loaded
7 8 9 |
# File 'lib/contextify/pending_context.rb', line 7 def path @path end |
Instance Method Details
#each {|name, block| ... } ⇒ Object
Iterates over each context name and block in the pending context.
64 65 66 |
# File 'lib/contextify/pending_context.rb', line 64 def each(&block) @blocks.each(&block) end |
#each_block {|block| ... } ⇒ Object
Iterates over each block in the pending context.
47 48 49 |
# File 'lib/contextify/pending_context.rb', line 47 def each_block(&block) @blocks.each_value(&block) end |
#each_class {|name| ... } ⇒ Object
Iterates over each context name in the pending context.
32 33 34 35 36 |
# File 'lib/contextify/pending_context.rb', line 32 def each_class(&block) @blocks.each_key do |name| block.call(Contextify.contexts[name]) end end |