Module: Edoxen::OfficersHost

Included in:
Meeting, MeetingComponent
Defined in:
lib/edoxen/officers_host.rb

Overview

Mixed into entities that carry an officers collection. Provides officers_with_role(role) and the chair accessor so Meeting and MeetingComponent share a single implementation.

The including class must declare an officers attribute whose entries expose role and person.

Instance Method Summary collapse

Instance Method Details

#chairObject



15
16
17
# File 'lib/edoxen/officers_host.rb', line 15

def chair
  officers_with_role("chair").first&.person
end

#officers_with_role(role) ⇒ Object



11
12
13
# File 'lib/edoxen/officers_host.rb', line 11

def officers_with_role(role)
  (officers || []).select { |o| o.role == role.to_s }
end