Class: MLB::CodeDescriptionType Abstract Private

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/code_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 code/description value objects from the MLB Stats API. These represent enumerated types that consist of a code identifier and human-readable description (e.g., pitch types, wind directions, sky conditions).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeString

Returns the type code identifier

Examples:

instance.code #=> "SL"

Returns:

  • (String)

    the type code identifier



20
# File 'lib/mlb/code_description_type.rb', line 20

attribute :code, Shale::Type::String

#descriptionString

Returns the human-readable description

Examples:

instance.description #=> "Slider"

Returns:

  • (String)

    the human-readable description



28
# File 'lib/mlb/code_description_type.rb', line 28

attribute :description, Shale::Type::String

Instance Method Details

#to_sString

Returns a string representation of the object

Examples:

pitch_type.to_s #=> "SL (Slider)"

Returns:

  • (String)

    string representation



41
42
43
# File 'lib/mlb/code_description_type.rb', line 41

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