class Contextify::PendingContext

Attributes

blocks[RW]

The blocks to be loaded

path[R]

The path being loaded

Public Class Methods

new(path) click to toggle source

Creates a new PendingContext object.

@param [String] path

The path the pending context was loaded from.
# File lib/contextify/pending_context.rb, line 18
def initialize(path)
  @path = File.expand_path(path)
  @blocks = {}
end

Public Instance Methods

each(&block) click to toggle source

Iterates over each context name and block in the pending context.

@yield [name, block]

The block will be passed each pending context block and it's
context name.

@yieldparam [String] name

The context name of the block.

@yieldparam [Proc] block

A pending context block.
# File lib/contextify/pending_context.rb, line 64
def each(&block)
  @blocks.each(&block)
end
each_block(&block) click to toggle source

Iterates over each block in the pending context.

@yield [block]

The block will be passed each pending context block.

@yieldparam [Proc] block

A pending context block.
# File lib/contextify/pending_context.rb, line 47
def each_block(&block)
  @blocks.each_value(&block)
end
each_class(&block) click to toggle source

Iterates over each context name in the pending context.

@yield [name]

The block will be passed each name of the pending context blocks.

@yieldparam [String] name

The name of a pending context block.
# File lib/contextify/pending_context.rb, line 32
def each_class(&block)
  @blocks.each_key do |name|
    block.call(Contextify.contexts[name])
  end
end