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:

  • (Boolean)

    whether this is left-handed



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:

  • (Boolean)

    whether this is right-handed



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:

  • (Boolean)

    whether this is switch



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

def switch? = code.eql?(SWITCH)