Class: MLB::IdDescriptionType Abstract Private

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

Overview

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

This class is abstract.

Subclass and define specific domain semantics

Base class for simple id/description value objects from the MLB Stats API. Similar to CodeDescriptionType but uses ‘id’ as the identifier field.

Direct Known Subclasses

GameType

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionString

Returns the human-readable description

Examples:

instance.description #=> "Regular Season"

Returns:

  • (String)

    the human-readable description



27
# File 'lib/mlb/id_description_type.rb', line 27

attribute :description, Shale::Type::String

#idString

Returns the type identifier

Examples:

instance.id #=> "R"

Returns:

  • (String)

    the type identifier



19
# File 'lib/mlb/id_description_type.rb', line 19

attribute :id, Shale::Type::String

Instance Method Details

#to_sString

Returns a string representation of the object

Examples:

game_type.to_s #=> "R (Regular Season)"

Returns:

  • (String)

    string representation



40
41
42
# File 'lib/mlb/id_description_type.rb', line 40

def to_s
  "#{id} (#{description})"
end