Class: Delegation
Overview
The Delegation class inherits from Array and describes methods that can be called on a Delegation for ease of display and database query.
Instance Method Summary collapse
-
#+(value) ⇒ Object
Overloads the + operator to return a new Delegation instead of an Array.
-
#<<(value) ⇒ Object
Overloads the << operator so the receiving object is not overwritten as an Array, and there are no nested Delegations.
-
#business_cards ⇒ Object
Maps all rep business cards.
-
#eigth ⇒ Object
Get the [7] index.
-
#fifth ⇒ Object
Get the [4] index.
-
#first_names ⇒ Object
Collects the first names of every rep in the Delegation.
-
#fourth ⇒ Object
Get the [3] index.
-
#last_names ⇒ Object
Collects the last names of every rep in the Delegation.
-
#ninth ⇒ Object
Get the [8] index.
-
#second ⇒ Object
Get the [1] index.
-
#seventh ⇒ Object
Get the [6] index.
-
#sixth ⇒ Object
Get the [5] index.
-
#tenth ⇒ Object
Get the [9] index.
-
#third ⇒ Object
Get the [2] index.
Methods inherited from Array
Instance Method Details
#+(value) ⇒ Object
Overloads the + operator to return a new Delegation instead of an Array.
14 15 16 17 18 19 20 |
# File 'lib/get-your-rep/delegation.rb', line 14 def +(value) if value.is_a?(Delegation) super.to_del else Delegation.new(super) end end |
#<<(value) ⇒ Object
Overloads the << operator so the receiving object is not overwritten as an Array, and there are no nested Delegations.
5 6 7 8 9 10 11 |
# File 'lib/get-your-rep/delegation.rb', line 5 def <<(value) if value.is_a?(Delegation) || value.is_a?(Array) self.replace(self + value) else super end end |
#business_cards ⇒ Object
Maps all rep business cards.
33 34 35 |
# File 'lib/get-your-rep/delegation.rb', line 33 def business_cards self.map { |rep| rep.business_card } end |
#eigth ⇒ Object
Get the [7] index.
68 69 70 |
# File 'lib/get-your-rep/delegation.rb', line 68 def eigth self[7] end |
#fifth ⇒ Object
Get the [4] index.
53 54 55 |
# File 'lib/get-your-rep/delegation.rb', line 53 def fifth self[4] end |
#first_names ⇒ Object
Collects the first names of every rep in the Delegation.
23 24 25 |
# File 'lib/get-your-rep/delegation.rb', line 23 def first_names self.map { |rep| rep.first_name } end |
#fourth ⇒ Object
Get the [3] index.
48 49 50 |
# File 'lib/get-your-rep/delegation.rb', line 48 def fourth self[3] end |
#last_names ⇒ Object
Collects the last names of every rep in the Delegation.
28 29 30 |
# File 'lib/get-your-rep/delegation.rb', line 28 def last_names self.map { |rep| rep.last_name } end |
#ninth ⇒ Object
Get the [8] index.
73 74 75 |
# File 'lib/get-your-rep/delegation.rb', line 73 def ninth self[8] end |
#second ⇒ Object
Get the [1] index.
38 39 40 |
# File 'lib/get-your-rep/delegation.rb', line 38 def second self[1] end |
#seventh ⇒ Object
Get the [6] index.
63 64 65 |
# File 'lib/get-your-rep/delegation.rb', line 63 def seventh self[6] end |
#sixth ⇒ Object
Get the [5] index.
58 59 60 |
# File 'lib/get-your-rep/delegation.rb', line 58 def sixth self[5] end |
#tenth ⇒ Object
Get the [9] index.
78 79 80 |
# File 'lib/get-your-rep/delegation.rb', line 78 def tenth self[9] end |
#third ⇒ Object
Get the [2] index.
43 44 45 |
# File 'lib/get-your-rep/delegation.rb', line 43 def third self[2] end |