Class: GitCompound::Command::Procedure::Procedure
- Inherits:
-
Object
- Object
- GitCompound::Command::Procedure::Procedure
- Extended by:
- Logger::Debugger
- Defined in:
- lib/git_compound/logger/debug/procedure.rb,
lib/git_compound/command/procedure/procedure.rb
Overview
Abstract Procedure class
Class Attribute Summary collapse
-
.steps ⇒ Object
readonly
Returns the value of attribute steps.
Class Method Summary collapse
-
.options ⇒ Object
Valid options available for this procedure see Element::Option.
-
.to_s ⇒ Object
Name of procedure.
Instance Method Summary collapse
-
#execute ⇒ Object
Main procedure entry point.
-
#execute! ⇒ Object
Method with additional messages etc.
- #execute_step(name) ⇒ Object
-
#initialize(_opts) ⇒ Procedure
constructor
A new instance of Procedure.
Methods included from Logger::Debugger
Constructor Details
#initialize(_opts) ⇒ Procedure
Returns a new instance of Procedure.
7 8 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 7 def initialize(_opts) end |
Class Attribute Details
.steps ⇒ Object (readonly)
Returns the value of attribute steps.
30 31 32 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 30 def steps @steps end |
Class Method Details
.options ⇒ Object
Valid options available for this procedure see Element::Option
35 36 37 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 35 def {} end |
.to_s ⇒ Object
Name of procedure
41 42 43 44 45 46 47 48 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 41 def to_s name.split('::').last .gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end |
Instance Method Details
#execute ⇒ Object
Main procedure entry point
18 19 20 21 22 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 18 def execute self.class.steps.to_h.keys.each do |name| execute_step(name) end end |
#execute! ⇒ Object
Method with additional messages etc.
12 13 14 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 12 def execute! execute end |
#execute_step(name) ⇒ Object
24 25 26 27 |
# File 'lib/git_compound/command/procedure/procedure.rb', line 24 def execute_step(name) step_proc = self.class.steps.to_h[name] instance_eval(&step_proc) if step_proc end |