class Deptree::Dependency

Attributes

actions[R]
name[R]
prerequisites[R]

Public Class Methods

new(name, prerequisites, helpers) click to toggle source
# File lib/deptree/dependency.rb, line 5
def initialize(name, prerequisites, helpers)
  @name = name
  @prerequisites = prerequisites
  @helpers = helpers
  @actions = Actions.new(self)
end

Public Instance Methods

action(name, &behaviour) click to toggle source
# File lib/deptree/dependency.rb, line 12
def action(name, &behaviour)
  @actions.add(name, behaviour)
end
execute(name) click to toggle source
# File lib/deptree/dependency.rb, line 16
def execute(name)
  if (action = @actions.find(name))
    action.execute
  end
end
execution_context() click to toggle source
# File lib/deptree/dependency.rb, line 22
def execution_context
  @execution_context ||= Object.new.tap do |ctx|
    ctx.extend(@helpers)
  end
end