Class: MLB::PitchCode

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

Overview

Represents a pitch code (result of a pitch)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ball_statusBoolean

Returns whether this counts as a ball

Examples:

pitch_code.ball_status #=> true

Returns:

  • (Boolean)

    whether this counts as a ball



47
# File 'lib/mlb/pitch_code.rb', line 47

attribute :ball_status, Shale::Type::Boolean

#codeString

Returns the pitch code

Examples:

pitch_code.code #=> "B"

Returns:

  • (String)

    the pitch code



15
# File 'lib/mlb/pitch_code.rb', line 15

attribute :code, Shale::Type::String

#descriptionString

Returns the description

Examples:

pitch_code.description #=> "Ball"

Returns:

  • (String)

    the description



23
# File 'lib/mlb/pitch_code.rb', line 23

attribute :description, Shale::Type::String

#sort_orderInteger

Returns the sort order

Examples:

pitch_code.sort_order #=> 1

Returns:

  • (Integer)

    the sort order



55
# File 'lib/mlb/pitch_code.rb', line 55

attribute :sort_order, Shale::Type::Integer

#strike_statusBoolean

Returns whether this counts as a strike

Examples:

pitch_code.strike_status #=> false

Returns:

  • (Boolean)

    whether this counts as a strike



39
# File 'lib/mlb/pitch_code.rb', line 39

attribute :strike_status, Shale::Type::Boolean

#swing_statusBoolean

Returns whether the batter swung

Examples:

pitch_code.swing_status #=> false

Returns:

  • (Boolean)

    whether the batter swung



31
# File 'lib/mlb/pitch_code.rb', line 31

attribute :swing_status, Shale::Type::Boolean

Instance Method Details

#ball?Boolean

Returns whether this counts as a ball

Examples:

pitch_code.ball? #=> true

Returns:

  • (Boolean)

    whether this counts as a ball



79
# File 'lib/mlb/pitch_code.rb', line 79

def ball? = ball_status

#strike?Boolean

Returns whether this counts as a strike

Examples:

pitch_code.strike? #=> false

Returns:

  • (Boolean)

    whether this counts as a strike



71
# File 'lib/mlb/pitch_code.rb', line 71

def strike? = strike_status

#swing?Boolean

Returns whether the batter swung

Examples:

pitch_code.swing? #=> false

Returns:

  • (Boolean)

    whether the batter swung



63
# File 'lib/mlb/pitch_code.rb', line 63

def swing? = swing_status