class ActionConductor::Collection

Attributes

conductors[R]

Public Class Methods

new(conductors = Array.new) click to toggle source
Calls superclass method
# File lib/action_conductor/collection.rb, line 8
def initialize(conductors = Array.new)
  @conductors = conductors
  super(@conductors)
end

Public Instance Methods

with_handle(handle) click to toggle source
# File lib/action_conductor/collection.rb, line 13
def with_handle(handle)
  conductors = selected_conductors_by_handle(handle)

  if conductors.empty?
    raise "No conductors with the handle: #{handle}"
  else
    conductors
  end
end

Private Instance Methods

selected_conductors_by_handle(handle) click to toggle source
# File lib/action_conductor/collection.rb, line 25
def selected_conductors_by_handle(handle)
  return self if handle.nil?
  self.class.new(conductors.select { |c| c.handle = handle })
end