Class: MLB::League

Inherits:
Shale::Mapper
  • Object
show all
Includes:
Comparable, ComparableByAttribute
Defined in:
lib/mlb/league.rb

Overview

Represents a league (e.g., American League, National League)

Constant Summary collapse

SEASON_PRESEASON =
"preseason".freeze
SEASON_INSEASON =
"inseason".freeze
SEASON_POSTSEASON =
"postseason".freeze
SEASON_OFFSEASON =
"offseason".freeze

Instance Method Summary collapse

Methods included from ComparableByAttribute

#<=>

Instance Method Details

#active?Boolean

Checks if the league is active

Examples:

league.active? #=> true

Returns:

  • (Boolean)

    whether the league is active



52
# File 'lib/mlb/league.rb', line 52

def active? = active

#comparable_attributeSymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the attribute used for sorting

Returns:

  • (Symbol)

    the attribute used for comparison



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

def comparable_attribute = :sort_order

#conferences?Boolean

Checks if the league uses conferences

Examples:

league.conferences? #=> false

Returns:

  • (Boolean)

    whether the league uses conferences



84
# File 'lib/mlb/league.rb', line 84

def conferences? = conferences_in_use

#divisions?Boolean

Checks if the league uses divisions

Examples:

league.divisions? #=> true

Returns:

  • (Boolean)

    whether the league uses divisions



92
# File 'lib/mlb/league.rb', line 92

def divisions? = divisions_in_use

#in_season?Boolean

Checks if the league is in season

Examples:

league.in_season? #=> true

Returns:

  • (Boolean)

    whether the league is in season



108
# File 'lib/mlb/league.rb', line 108

def in_season? = season_state.eql?(SEASON_INSEASON)

#offseason?Boolean

Checks if the league is in offseason

Examples:

league.offseason? #=> false

Returns:

  • (Boolean)

    whether the league is in offseason



124
# File 'lib/mlb/league.rb', line 124

def offseason? = season_state.eql?(SEASON_OFFSEASON)

#playoff_points?Boolean

Checks if the league uses playoff points

Examples:

league.playoff_points? #=> false

Returns:

  • (Boolean)

    whether the league uses playoff points



76
# File 'lib/mlb/league.rb', line 76

def playoff_points? = has_playoff_points

#postseason?Boolean

Checks if the league is in postseason

Examples:

league.postseason? #=> false

Returns:

  • (Boolean)

    whether the league is in postseason



116
# File 'lib/mlb/league.rb', line 116

def postseason? = season_state.eql?(SEASON_POSTSEASON)

#preseason?Boolean

Checks if the league is in preseason

Examples:

league.preseason? #=> false

Returns:

  • (Boolean)

    whether the league is in preseason



100
# File 'lib/mlb/league.rb', line 100

def preseason? = season_state.eql?(SEASON_PRESEASON)

#split_season?Boolean

Checks if the league has a split season

Examples:

league.split_season? #=> false

Returns:

  • (Boolean)

    whether the league has a split season



68
# File 'lib/mlb/league.rb', line 68

def split_season? = has_split_season

#wildcard?Boolean

Checks if the league has a wildcard

Examples:

league.wildcard? #=> true

Returns:

  • (Boolean)

    whether the league has a wildcard



60
# File 'lib/mlb/league.rb', line 60

def wildcard? = has_wildcard