Module: HasLifecycle

Included in:
GeoCLI, GeoEngineer::Environment, GeoEngineer::Project, GeoEngineer::Resource
Defined in:
lib/geoengineer/utils/has_lifecycle.rb

Overview

HasLifecycle provides methods to enable lifecycle hooks

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


5
6
7
# File 'lib/geoengineer/utils/has_lifecycle.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#execute_lifecycle(stage, step) ⇒ Object

This method will return a list of errors if not valid, or nil


45
46
47
48
49
50
51
52
53
# File 'lib/geoengineer/utils/has_lifecycle.rb', line 45

def execute_lifecycle(stage, step)
  self.class.lifecycle_actions(stage, step).each do |actions|
    if actions.is_a? Proc
      self.instance_exec(&actions)
    else
      self.send(actions)
    end
  end
end