class ThreeScaleToolbox::Commands::ProductCommand::CopyCommand::DeleteExistingTargetBackendUsagesTask

Attributes

context[R]

Public Class Methods

new(context) click to toggle source
# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 8
def initialize(context)
  @context = context
end

Public Instance Methods

call() click to toggle source

entrypoint

# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 13
def call
  conflicting_target_backend_usage_list.each(&:delete)
end

Private Instance Methods

conflicting_target_backend_usage_list() click to toggle source

List of target backend usage items that match source backend usage paths

# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 20
def conflicting_target_backend_usage_list
  # Compute array intersection
  target_backend_usage_list.select do |target_usage|
    source_backend_usage_list.find do |source_usage|
      target_usage.path == source_usage.path
    end
  end
end
source() click to toggle source
# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 41
def source
  context[:source]
end
source_backend_usage_list() click to toggle source
# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 29
def source_backend_usage_list
  @source_backend_usage_list ||= source.backend_usage_list
end
target() click to toggle source
# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 37
def target
  context[:target]
end
target_backend_usage_list() click to toggle source
# File lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb, line 33
def target_backend_usage_list
  @target_backend_usage_list ||= target.backend_usage_list
end