Class: CM::Plugin::Sequence
- Inherits:
-
Object
- Object
- CM::Plugin::Sequence
- Defined in:
- lib/core/plugin/sequence.rb
Instance Method Summary collapse
-
#forward(operation) ⇒ Object
—————————————————————————– Operations.
-
#init_resources ⇒ Object
—.
-
#initialized?(options = {}) ⇒ Boolean
—————————————————————————– Checks.
-
#normalize(reload) ⇒ Object
—————————————————————————– Plugin interface.
-
#plan ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#resources ⇒ Object
—.
- #resources=(resources) ⇒ Object
-
#reverse(operation) ⇒ Object
—.
-
#settings ⇒ Object
—.
Instance Method Details
#forward(operation) ⇒ Object
Operations
68 69 70 71 72 73 74 75 76 |
# File 'lib/core/plugin/sequence.rb', line 68 def forward(operation) if initialized? success = true success = yield(success) if block_given? else success = false end success end |
#init_resources ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/core/plugin/sequence.rb', line 20 def init_resources @resources = [] get_array(:resources).each do |resource_config| resource_config = Nucleon::Config.ensure(resource_config) if resource_config.has_key?(:aggregate) # Array @resources << plan.create_batch(resource_config[:aggregate]) else # Atomic @resources << plan.create_resource(resource_config) end end @resources end |
#initialized?(options = {}) ⇒ Boolean
Checks
37 38 39 |
# File 'lib/core/plugin/sequence.rb', line 37 def initialized?( = {}) !@resources.empty? end |
#normalize(reload) ⇒ Object
Plugin interface
9 10 11 12 13 14 15 16 |
# File 'lib/core/plugin/sequence.rb', line 9 def normalize(reload) super @plan = delete(:plan, nil) unless reload init_resources yield if block_given? end |
#plan ⇒ Object
Property accessors / modifiers
44 45 46 |
# File 'lib/core/plugin/sequence.rb', line 44 def plan @plan end |
#resources ⇒ Object
56 57 58 |
# File 'lib/core/plugin/sequence.rb', line 56 def resources @resources end |
#resources=(resources) ⇒ Object
60 61 62 63 |
# File 'lib/core/plugin/sequence.rb', line 60 def resources=resources set(:resources, Nucleon::Util::Data.array(resources)) init_resources end |
#reverse(operation) ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/core/plugin/sequence.rb', line 80 def reverse(operation) if initialized? success = true success = yield(success) if block_given? else success = false end success end |
#settings ⇒ Object
50 51 52 |
# File 'lib/core/plugin/sequence.rb', line 50 def settings get_hash(:settings) end |