Sha256: 129d69f06414f6269ed27a83765d1cd00ccad0ed972845838411e80252087d38

Contents?: true

Size: 381 Bytes

Versions: 35

Compression:

Stored size: 381 Bytes

Contents

# encoding: utf-8

require 'tsort'

module Adhearsion
  class Plugin
    class Collection < Array
      include TSort

      alias :tsort_each_node :each

      def tsort_each_child(child, &block)
        select { |i| i.before == child.name || i.name == child.after }.each(&block)
      end

      def +(other)
        Collection.new(to_a + other.to_a)
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
adhearsion-2.6.4 lib/adhearsion/plugin/collection.rb
adhearsion-2.6.3 lib/adhearsion/plugin/collection.rb
adhearsion-3.0.0.rc1 lib/adhearsion/plugin/collection.rb
adhearsion-3.0.0.beta2 lib/adhearsion/plugin/collection.rb
adhearsion-3.0.0.beta1 lib/adhearsion/plugin/collection.rb
adhearsion-2.6.2 lib/adhearsion/plugin/collection.rb
adhearsion-2.6.1 lib/adhearsion/plugin/collection.rb
adhearsion-2.6.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.5.4 lib/adhearsion/plugin/collection.rb
adhearsion-2.5.3 lib/adhearsion/plugin/collection.rb
adhearsion-2.5.2 lib/adhearsion/plugin/collection.rb
adhearsion-2.5.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.4.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.4.0.beta3 lib/adhearsion/plugin/collection.rb
adhearsion-2.4.0.beta2 lib/adhearsion/plugin/collection.rb
adhearsion-2.4.0.beta1 lib/adhearsion/plugin/collection.rb
adhearsion-2.3.5 lib/adhearsion/plugin/collection.rb
adhearsion-2.3.4 lib/adhearsion/plugin/collection.rb
adhearsion-2.3.3 lib/adhearsion/plugin/collection.rb
adhearsion-2.3.2 lib/adhearsion/plugin/collection.rb