Class: Deptree::Dependency::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/deptree/dependency/actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, behaviour, context) ⇒ Action

Returns a new instance of Action.



28
29
30
# File 'lib/deptree/dependency/actions.rb', line 28

def initialize(name, behaviour, context)
  @name, @behaviour, @context = name, behaviour, context
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



26
27
28
# File 'lib/deptree/dependency/actions.rb', line 26

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



36
37
38
# File 'lib/deptree/dependency/actions.rb', line 36

def ==(other)
  name == other.name
end

#executeObject



32
33
34
# File 'lib/deptree/dependency/actions.rb', line 32

def execute
  @context.instance_eval(&@behaviour)
end