module Contextify::ContextifiedClassMethods

Attributes

context_name[R]

The name of the context

Public Instance Methods

load_context(path,*arguments) click to toggle source

Loads a compatible context.

@param [String] path

The path to load the context from.

@param [Array] arguments

Additional arguments to use when creating the context.

@return [Object]

The loaded context.
# File lib/contextify/contextified_class_methods.rb, line 31
def load_context(path,*arguments)
  pending = Contextify.load_blocks(path)

  pending_name, pending_block = pending.find do |name,block|
    Contextify.contexts[name].ancestors.include?(self)
  end

  if (pending_name && pending_block)
    obj = Contextify.contexts[pending_name].new(*arguments)
    obj.instance_eval(&pending_block)
    obj
  end
end
load_context_block(path) click to toggle source

Loads a block defined under the context.

@param [String] path

The path to load the block from.

@return [Proc]

The block defined for the context.
# File lib/contextify/contextified_class_methods.rb, line 15
def load_context_block(path)
  Contextify.load_block(@context_name,path)
end