Class: KeyPersonnelCollection
- Inherits:
-
CollectionsFactory
- Object
- CollectionsFactory
- KeyPersonnelCollection
- Defined in:
- lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb
Overview
KeyPersonObject
Instance Method Summary collapse
- #co_investigator ⇒ Object
- #key_person(role) ⇒ Object
- #names ⇒ Object
- #person(full_name) ⇒ Object
- #principal_investigator ⇒ Object
- #roles ⇒ Object
-
#uncertified_person(role) ⇒ Object
IMPORTANT: This method returns a KeyPersonObject–meaning that if there are multiple key persons in the collection that match this search only the first one will be returned.
- #unit_names ⇒ Object
- #unit_numbers ⇒ Object
- #units ⇒ Object
-
#with_units ⇒ Object
returns an array of KeyPersonObjects who have associated units.
Instance Method Details
#co_investigator ⇒ Object
281 282 283 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 281 def co_investigator self.find { |person| person.role=='Co-Investigator' } end |
#key_person(role) ⇒ Object
285 286 287 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 285 def key_person(role) self.find { |person| person.key_person_role==role } end |
#names ⇒ Object
247 248 249 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 247 def names self.collect { |person| person.full_name } end |
#person(full_name) ⇒ Object
267 268 269 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 267 def person(full_name) self.find { |person| person.full_name==full_name } end |
#principal_investigator ⇒ Object
277 278 279 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 277 def principal_investigator self.find { |person| person.role=='Principal Investigator' || person.role=='PI/Contact' } end |
#roles ⇒ Object
251 252 253 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 251 def roles self.collect{ |person| person.role }.uniq end |
#uncertified_person(role) ⇒ Object
IMPORTANT: This method returns a KeyPersonObject–meaning that if there are multiple key persons in the collection that match this search only the first one will be returned. If you need a collection of multiple persons write the method for that.
293 294 295 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 293 def uncertified_person(role) self.find { |person| person.certified==false && person.role==role } end |
#unit_names ⇒ Object
255 256 257 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 255 def unit_names units.collect{ |unit| unit[:name] }.uniq end |
#unit_numbers ⇒ Object
259 260 261 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 259 def unit_numbers units.collect{ |unit| unit[:number] }.uniq end |
#units ⇒ Object
263 264 265 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 263 def units self.collect{ |person| person.units }.flatten end |
#with_units ⇒ Object
returns an array of KeyPersonObjects who have associated units
273 274 275 |
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 273 def with_units self.find_all { |person| person.units.size > 0 } end |