Class: Stattleship::Models::Player
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Stattleship::Models::Player
- Defined in:
- lib/stattleship/models/player.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #dump ⇒ Object
- #full_name ⇒ Object
- #inflielder? ⇒ Boolean
- #label ⇒ Object
- #outflielder? ⇒ Boolean
- #pitcher? ⇒ Boolean
- #team_hash ⇒ Object
- #team_name ⇒ Object
- #team_nickname ⇒ Object
Instance Method Details
#active? ⇒ Boolean
4 5 6 |
# File 'lib/stattleship/models/player.rb', line 4 def active? active end |
#dump ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/stattleship/models/player.rb', line 58 def dump { active: active?, birth_date: birth_date, first_name: first_name, handedness: handedness, height: height, humanized_salary: humanized_salary, inflielder: inflielder?, label: label, last_name: last_name, name: name, outflielder: outflielder?, pitcher: pitcher?, position_abbreviation: position_abbreviation, position_name: position_name, salary: salary, salary_currency: salary_currency, school: school, slug: slug, sport: sport, team_name: team_name, team_nickname: team_nickname, team: team_hash, unit_of_height: unit_of_height, unit_of_weight: unit_of_weight, weight: weight, years_of_experience: years_of_experience, city: city, state: state, country: country, draft_season: draft_season, draft_round: draft_round, draft_overall_pick: draft_overall_pick, draft_team_name: draft_team_name, } end |
#full_name ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/stattleship/models/player.rb', line 8 def full_name if name == '' "#{first_name} #{last_name}" else name end end |
#inflielder? ⇒ Boolean
43 44 45 46 47 48 49 |
# File 'lib/stattleship/models/player.rb', line 43 def inflielder? position_abbreviation == '1B' || position_abbreviation == '2B' || position_abbreviation == '3B' || position_abbreviation == 'SS' || position_abbreviation == 'C' end |
#label ⇒ Object
16 17 18 |
# File 'lib/stattleship/models/player.rb', line 16 def label "#{full_name} (#{position_abbreviation}) - #{team_nickname}" end |
#outflielder? ⇒ Boolean
51 52 53 54 55 56 |
# File 'lib/stattleship/models/player.rb', line 51 def outflielder? position_abbreviation == 'LF' || position_abbreviation == 'CF' || position_abbreviation == 'RF' || position_abbreviation == 'OF' end |
#pitcher? ⇒ Boolean
38 39 40 41 |
# File 'lib/stattleship/models/player.rb', line 38 def pitcher? position_abbreviation == 'SP' || position_abbreviation == 'RP' end |
#team_hash ⇒ Object
32 33 34 35 36 |
# File 'lib/stattleship/models/player.rb', line 32 def team_hash if team team.dump end end |
#team_name ⇒ Object
20 21 22 23 24 |
# File 'lib/stattleship/models/player.rb', line 20 def team_name if team team.name end end |
#team_nickname ⇒ Object
26 27 28 29 30 |
# File 'lib/stattleship/models/player.rb', line 26 def team_nickname if team team.nickname end end |