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
- #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
50 51 52 53 54 55 56 57 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 |
# File 'lib/stattleship/models/player.rb', line 50 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 |
#inflielder? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/stattleship/models/player.rb', line 35 def inflielder? position_abbreviation == '1B' || position_abbreviation == '2B' || position_abbreviation == '3B' || position_abbreviation == 'SS' || position_abbreviation == 'C' end |
#label ⇒ Object
8 9 10 |
# File 'lib/stattleship/models/player.rb', line 8 def label "#{name} (#{position_abbreviation}) - #{team_nickname}" end |
#outflielder? ⇒ Boolean
43 44 45 46 47 48 |
# File 'lib/stattleship/models/player.rb', line 43 def outflielder? position_abbreviation == 'LF' || position_abbreviation == 'CF' || position_abbreviation == 'RF' || position_abbreviation == 'OF' end |
#pitcher? ⇒ Boolean
30 31 32 33 |
# File 'lib/stattleship/models/player.rb', line 30 def pitcher? position_abbreviation == 'SP' || position_abbreviation == 'RP' end |
#team_hash ⇒ Object
24 25 26 27 28 |
# File 'lib/stattleship/models/player.rb', line 24 def team_hash if team team.dump end end |
#team_name ⇒ Object
12 13 14 15 16 |
# File 'lib/stattleship/models/player.rb', line 12 def team_name if team team.name end end |
#team_nickname ⇒ Object
18 19 20 21 22 |
# File 'lib/stattleship/models/player.rb', line 18 def team_nickname if team team.nickname end end |