Class: MLB::Handedness

Inherits:
CodeDescriptionType show all
Defined in:
lib/mlb/handedness.rb

Overview

Represents handedness (batting or throwing side)

Constant Summary collapse

LEFT =
"L".freeze
RIGHT =
"R".freeze
SWITCH =
"S".freeze

Instance Attribute Summary

Attributes inherited from CodeDescriptionType

#code, #description

Instance Method Summary collapse

Methods inherited from CodeDescriptionType

#to_s

Instance Method Details

#left? ⇒ Boolean

Returns whether this is left-handed

Examples:

handedness.left? #=> true

Returns:

  • whether this is left-handed

API:

  • public



16
# File 'lib/mlb/handedness.rb', line 16

def left? = code.eql?(LEFT)

#right? ⇒ Boolean

Returns whether this is right-handed

Examples:

handedness.right? #=> false

Returns:

  • whether this is right-handed

API:

  • public



24
# File 'lib/mlb/handedness.rb', line 24

def right? = code.eql?(RIGHT)

#switch? ⇒ Boolean

Returns whether this is switch (both sides)

Examples:

handedness.switch? #=> false

Returns:

  • whether this is switch

API:

  • public



32
# File 'lib/mlb/handedness.rb', line 32

def switch? = code.eql?(SWITCH)