Sha256: 0fe65ef585d2925d197278a49181ce22d2717ca24efa2f2ea914f741ef5683bb

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

module ThreeScaleToolbox
  module Tasks
    module CopyTask
      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
      end

      attr_reader :context

      def initialize(context)
        @context = context
      end

      def source
        context[:source]
      end

      def target
        context[:target]
      end

      def source_metrics
        context[:source_metrics] ||= source.metrics
      end

      def source_hits
        context[:source_hits] ||= source.hits
      end

      def source_methods
        context[:source_methods] ||= source.methods(source_hits.fetch('id'))
      end

      def source_metrics_and_methods
        source_metrics + source_methods
      end

      def target_metrics
        context[:target_metrics] ||= target.metrics
      end

      def target_hits
        context[:target_hits] ||= target.hits
      end

      def target_methods
        context[:target_methods] ||= target.methods(target_hits.fetch('id'))
      end

      def target_metrics_and_methods
        target_metrics + target_methods
      end

      def invalidate_target_methods
        context[:target_methods] = nil
      end

      def invalidate_target_metrics
        context[:target_metrics] = nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
3scale_toolbox-0.15.0 lib/3scale_toolbox/tasks/copy_task.rb
3scale_toolbox-0.14.0 lib/3scale_toolbox/tasks/copy_task.rb
3scale_toolbox-0.13.0 lib/3scale_toolbox/tasks/copy_task.rb
3scale_toolbox-0.12.4 lib/3scale_toolbox/tasks/copy_task.rb
3scale_toolbox-0.12.3 lib/3scale_toolbox/tasks/copy_task.rb
3scale_toolbox-0.12.2 lib/3scale_toolbox/tasks/copy_task.rb