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.3.1 lib/adhearsion/plugin/collection.rb
adhearsion-2.3.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.2.1 lib/adhearsion/plugin/collection.rb
adhearsion-2.2.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.1.3 lib/adhearsion/plugin/collection.rb
adhearsion-2.1.2 lib/adhearsion/plugin/collection.rb
adhearsion-2.1.1 lib/adhearsion/plugin/collection.rb
adhearsion-2.1.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.1 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.0 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.0.rc5 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.0.rc4 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.0.rc3 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.0.rc2 lib/adhearsion/plugin/collection.rb
adhearsion-2.0.0.rc1 lib/adhearsion/plugin/collection.rb