class ASF::Board::ShepherdStream

source for shepherd information, yields a stream of director names in random order

Public Class Methods

new(actions) click to toggle source
Calls superclass method
# File lib/whimsy/asf/board.rb, line 110
def initialize(actions)
  @actions = (actions || []).reverse
  @directors = ASF::Service['board'].members

  super() do |generator|
    list = []
    loop do
      list = @directors.shuffle if list.empty?
      victim = list.pop
      firstname = ASF::Board.directorFirstName(victim.id) ||
        victim.public_name.split(' ').first
      generator.yield firstname
    end
  end
end

Public Instance Methods

for(pmc) click to toggle source
# File lib/whimsy/asf/board.rb, line 126
def for(pmc)
  chair = pmc.chair
  raise "no chair found for #{pmc.name}" unless chair

  action = @actions.find {|action| action[:pmc] == pmc.display_name}

  if action
    "#{chair.public_name} / #{action[:owner]}"
  elsif @directors.include? chair
    chair.public_name
  else
    "#{chair.public_name} / #{self.next}"
  end
end