module Peregrine::Collections::Systemic

Provides methods for filtering System objects contained in a collection. This module is intended to be an extension to existing collection instances.

Public Instance Methods

disabled() { |system| ... } click to toggle source

Returns an array of disabled System objects in the collection. Yields the matching System instances if a block is given.

# File lib/peregrine/collections/systemic.rb, line 20
def disabled
  systems = select do |system|
    next unless system.respond_to?(:enabled?)
    !system.enabled?
  end
  systems.each { |system| yield system } if block_given?
  systems.extend(Collections)
end
enabled() { |system| ... } click to toggle source

Returns an array of enabled System objects in the collection. Yields the matching System instances if a block is given.

# File lib/peregrine/collections/systemic.rb, line 9
def enabled
  systems = select do |system|
    next unless system.respond_to?(:enabled?)
    system.enabled?
  end
  systems.each { |system| yield system } if block_given?
  systems.extend(Collections)
end