Sha256: ed324e2ebb83418f1ea81877470f14bdb4d63d60a8af37375b7725b6f07afea0

Contents?: true

Size: 935 Bytes

Versions: 253

Compression:

Stored size: 935 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module Avm
  module Launcher
    class Context
      class InstanceCollector
        common_constructor :context

        def add_all
          instances_set.merge(context.instances)
          self
        end

        def add_path(path)
          instances_set.merge(instances_on_path(path))
          self
        end

        def add_pending
          instances_set.merge(context.pending_instances)
          self
        end

        def instances
          instances_set.sort
        end

        private

        def instance_match?(instance, instance_name)
          ::File.fnmatch?(instance_name, instance.name)
        end

        def instances_on_path(path)
          context.instances.select { |instance| instance_match?(instance, path) }
        end

        def instances_set
          @instances_set ||= ::Set.new
        end
      end
    end
  end
end

Version data entries

253 entries across 253 versions & 3 rubygems

Version Path
avm-0.94.1 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.98.0 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.94.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.94.0 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.93.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.92.0 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.92.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.91.0 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.90.1 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.87.1 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.90.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.87.0 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.89.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.86.12 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.88.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.86.11 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.87.0 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.86.8 sub/avm/lib/avm/launcher/context/instance_collector.rb
avm-0.86.2 lib/avm/launcher/context/instance_collector.rb
eac_tools-0.86.7 sub/avm/lib/avm/launcher/context/instance_collector.rb