Module: GitCompound::Command::Procedure::Element::Subprocedure

Included in:
Build, BuildLock, BuildManifest, Update
Defined in:
lib/git_compound/command/procedure/element/subprocedure.rb

Overview

Subprocedure mixin

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(parent_class) ⇒ Object



8
9
10
# File 'lib/git_compound/command/procedure/element/subprocedure.rb', line 8

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

Instance Method Details

#initialize(args) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/git_compound/command/procedure/element/subprocedure.rb', line 12

def initialize(args)
  @subprocedures = {}

  self.class.subprocedures.to_h.each_pair do |name, procedure|
    @subprocedures.store(name, procedure.new(args))
  end

  super
end

#subprocedure(name) ⇒ Object



22
23
24
# File 'lib/git_compound/command/procedure/element/subprocedure.rb', line 22

def subprocedure(name)
  @subprocedures[name.to_sym].execute
end