Class: Stattleship::Models::LineUp
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Stattleship::Models::LineUp
- Defined in:
- lib/stattleship/models/line_up.rb
Instance Method Summary collapse
- #dump ⇒ Object
- #inflielder? ⇒ Boolean
- #outflielder? ⇒ Boolean
- #pitcher? ⇒ Boolean
- #player_label ⇒ Object
- #player_name ⇒ Object
- #team_hash ⇒ Object
- #team_name ⇒ Object
- #team_nickname ⇒ Object
- #to_sentence ⇒ Object
Instance Method Details
#dump ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/stattleship/models/line_up.rb', line 55 def dump { id: id, player_name: player_name, inning_half: inning_half, position_name: position_name, position_abbreviation: position_abbreviation, inning: inning, batting_order: batting_order, lineup_position: lineup_position, sequence: sequence, } end |
#inflielder? ⇒ Boolean
39 40 41 42 43 44 45 |
# File 'lib/stattleship/models/line_up.rb', line 39 def inflielder? position_abbreviation == '1B' || position_abbreviation == '2B' || position_abbreviation == '3B' || position_abbreviation == 'SS' || position_abbreviation == 'C' end |
#outflielder? ⇒ Boolean
47 48 49 50 51 52 |
# File 'lib/stattleship/models/line_up.rb', line 47 def outflielder? position_abbreviation == 'LF' || position_abbreviation == 'CF' || position_abbreviation == 'RF' || position_abbreviation == 'OF' end |
#pitcher? ⇒ Boolean
34 35 36 37 |
# File 'lib/stattleship/models/line_up.rb', line 34 def pitcher? position_abbreviation == 'SP' || position_abbreviation == 'RP' end |
#player_label ⇒ Object
12 13 14 |
# File 'lib/stattleship/models/line_up.rb', line 12 def player_label player.label end |
#player_name ⇒ Object
8 9 10 |
# File 'lib/stattleship/models/line_up.rb', line 8 def player_name player.full_name end |
#team_hash ⇒ Object
28 29 30 31 32 |
# File 'lib/stattleship/models/line_up.rb', line 28 def team_hash if team team.dump end end |
#team_name ⇒ Object
16 17 18 19 20 |
# File 'lib/stattleship/models/line_up.rb', line 16 def team_name if team team.name end end |
#team_nickname ⇒ Object
22 23 24 25 26 |
# File 'lib/stattleship/models/line_up.rb', line 22 def team_nickname if team team.nickname end end |
#to_sentence ⇒ Object
4 5 6 |
# File 'lib/stattleship/models/line_up.rb', line 4 def to_sentence "#{player_label} : #{inning_half} #{inning} inning #{batting_order} batting order #{lineup_position} lineup position" end |