Class: MLB::PlayResult

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/play.rb

Overview

Represents the result of a play

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#away_scoreInteger

Returns the away score after this play

Examples:

result.away_score #=> 0

Returns:

  • (Integer)

    the away score



54
# File 'lib/mlb/play.rb', line 54

attribute :away_score, Shale::Type::Integer

#descriptionString

Returns the description

Examples:

result.description #=> "Francisco Lindor grounds out..."

Returns:

  • (String)

    the description



38
# File 'lib/mlb/play.rb', line 38

attribute :description, Shale::Type::String

#eventString

Returns the event name

Examples:

result.event #=> "Groundout"

Returns:

  • (String)

    the event name



22
# File 'lib/mlb/play.rb', line 22

attribute :event, Shale::Type::String

#event_typeString

Returns the event type code

Examples:

result.event_type #=> "field_out"

Returns:

  • (String)

    the event type code



30
# File 'lib/mlb/play.rb', line 30

attribute :event_type, Shale::Type::String

#home_scoreInteger

Returns the home score after this play

Examples:

result.home_score #=> 0

Returns:

  • (Integer)

    the home score



62
# File 'lib/mlb/play.rb', line 62

attribute :home_score, Shale::Type::Integer

#is_outBoolean

Returns whether this play resulted in an out

Examples:

result.out? #=> true

Returns:

  • (Boolean)

    whether an out occurred



70
# File 'lib/mlb/play.rb', line 70

attribute :is_out, Shale::Type::Boolean

#rbiInteger

Returns the RBIs on this play

Examples:

result.rbi #=> 0

Returns:

  • (Integer)

    the RBIs



46
# File 'lib/mlb/play.rb', line 46

attribute :rbi, Shale::Type::Integer

#typeString

Returns the result type

Examples:

result.type #=> "atBat"

Returns:

  • (String)

    the result type



14
# File 'lib/mlb/play.rb', line 14

attribute :type, Shale::Type::String

Instance Method Details

#out?Boolean

Returns whether this play resulted in an out

Examples:

result.out? #=> true

Returns:

  • (Boolean)

    whether an out occurred



78
79
80
# File 'lib/mlb/play.rb', line 78

def out?
  is_out
end