Class: Tataru::SubPlanner
- Inherits:
-
Object
- Object
- Tataru::SubPlanner
- Defined in:
- lib/tataru/sub_planner.rb
Overview
returns subroutines required based on the resource
Instance Method Summary collapse
- #compile(*args) ⇒ Object
- #extra_subroutines ⇒ Object
-
#initialize(rrep, action) ⇒ SubPlanner
constructor
A new instance of SubPlanner.
- #name ⇒ Object
- #subroutines ⇒ Object
Constructor Details
#initialize(rrep, action) ⇒ SubPlanner
Returns a new instance of SubPlanner.
6 7 8 9 |
# File 'lib/tataru/sub_planner.rb', line 6 def initialize(rrep, action) @rrep = rrep @action = action end |
Instance Method Details
#compile(*args) ⇒ Object
15 16 17 |
# File 'lib/tataru/sub_planner.rb', line 15 def compile(*args) SubroutineCompiler.new(@rrep, *args) end |
#extra_subroutines ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tataru/sub_planner.rb', line 19 def extra_subroutines return {} unless @action == :update { "#{name}_modify" => compile(:modify), "#{name}_modify_check" => compile(:modify_check), "#{name}_recreate" => compile(:recreate), "#{name}_recreate_check" => compile(:recreate_check), "#{name}_recreate_commit" => compile(:recreate_commit), "#{name}_recreate_finish" => compile(:recreate_finish) } end |
#name ⇒ Object
11 12 13 |
# File 'lib/tataru/sub_planner.rb', line 11 def name @rrep.name end |
#subroutines ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/tataru/sub_planner.rb', line 32 def subroutines { "#{name}_start" => compile(:"#{@action}"), "#{name}_check" => compile(:"check_#{@action}"), "#{name}_commit" => compile(:"commit_#{@action}"), "#{name}_finish" => compile(:"finish_#{@action}") }.merge(extra_subroutines) end |