Class | Person
In: | app/models/person.rb
Parent: | ActiveRecord::Base

個人のモデル。

### Methods

colleagues companies exists_with_people? groups name_with_in neighbors organizations people posts preferred_company preferred_organization preferred_post

### Public Class methods

exists_with_people?(p, q)

p と q が同一かどうかを判定する。

[Source]

        # File app/models/person.rb, line 41
    41:   def self.exists_with_people?(p, q)
    42:     return (p == q)
    43:   end

### Public Instance methods

colleagues()

同じ組織に属する個人を配列で返す。

[Source]

        # File app/models/person.rb, line 66
    66:   def colleagues
    67:     organizations.inject([]) do |seed, organization|
    68:       seed | organization.people
    69:     end
    70:   end

companies()

所属する企業を配列で返す。

[Source]

        # File app/models/person.rb, line 46
    46:   def companies
    47:     company_members.map(&:company).flatten
    48:   end

groups()

所属するグループを配列で返す。

[Source]

        # File app/models/person.rb, line 61
    61:   def groups
    62:     group_members.map(&:group).flatten
    63:   end

name_with_in()

名前および企業の名前と組織の名前を返す。

[Source]

        # File app/models/person.rb, line 80
    80:   def name_with_in
    81:     if company = preferred_company
    82:       if organization = preferred_organization
    83:         "#{name} (#{preferred_company.name}/#{preferred_organization.name})"
    84:       else
    85:         "#{name} (#{preferred_company.name})"
    86:       end
    87:     end
    88:     return name
    89:   end

neighbors()

同じグループに属する個人を配列で返す。

[Source]

        # File app/models/person.rb, line 73
    73:   def neighbors
    74:     groups.inject([]) do |seed, group|
    75:       seed | group.people
    76:     end
    77:   end

organizations()

所属する組織を配列で返す。

[Source]

        # File app/models/person.rb, line 56
    56:   def organizations
    57:     organization_members.map(&:organization).flatten
    58:   end

people()

個人の集合を返す。

[Source]

         # File app/models/person.rb, line 107
    107:   def people
    108:     [self]
    109:   end

posts()

役職を配列で返す。

[Source]

        # File app/models/person.rb, line 51
    51:   def posts
    52:     posted_tos.map(&:post).flatten
    53:   end

preferred_company()

優先される所属企業を返す。

[Source]

        # File app/models/person.rb, line 92
    92:   def preferred_company
    93:     get_preferred("company")
    94:   end

preferred_organization()

優先される所属組織を返す。

[Source]

         # File app/models/person.rb, line 102
    102:   def preferred_organization
    103:     get_preferred("organization")
    104:   end

preferred_post()

優先される役職を返す。

[Source]

        # File app/models/person.rb, line 97
    97:   def preferred_post
    98:     get_preferred("post")
    99:   end

[Validate]