Sha256: 26756591f34f950d0f49a74f2ff624bd6f54218c79d2b275f1fcb2a62bf0d619

Contents?: true

Size: 643 Bytes

Versions: 19

Compression:

Stored size: 643 Bytes

Contents

module Vpsb
  class BaseTask
    @prepare_squence = []
    attr_reader :core, :prepare_squence

    def initialize(core)
      @core = core
    end

    def self.prepare_squence(*resource)
      (@prepare_squence ||= []).push(*resource)
    end

    def prepare_squence
      self.class.instance_variable_get(:@prepare_squence)
    end

    protected

    def prepare
      (prepare_squence || []).each{ |r| core.get(r) }
    end

    def reprepare
      (prepare_squence || []).each{ |r| core.get(r, force:true) }
    end

    def preparation_results
      (prepare_squence || []).inject({}){ |h, r| h[r] = core.get(r); h }
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
vpsb-1.1.8 lib/vpsb/base_task.rb
vpsb-1.1.7 lib/vpsb/base_task.rb
vpsb-1.1.6 lib/vpsb/base_task.rb
vpsb-1.1.5 lib/vpsb/base_task.rb
vpsb-1.1.4 lib/vpsb/base_task.rb
vpsb-1.1.3 lib/vpsb/base_task.rb
vpsb-1.1.2 lib/vpsb/base_task.rb
vpsb-1.1.1 lib/vpsb/base_task.rb
vpsb-1.1.0 lib/vpsb/base_task.rb
vpsb-1.0.9 lib/vpsb/base_task.rb
vpsb-1.0.8 lib/vpsb/base_task.rb
vpsb-1.0.7 lib/vpsb/base_task.rb
vpsb-1.0.6 lib/vpsb/base_task.rb
vpsb-1.0.5 lib/vpsb/base_task.rb
vpsb-1.0.4 lib/vpsb/base_task.rb
vpsb-1.0.3 lib/vpsb/base_task.rb
vpsb-1.0.2 lib/vpsb/base_task.rb
vpsb-1.0.1 lib/vpsb/base_task.rb
vpsb-1.0.0 lib/vpsb/base_task.rb