Class: Sports::League
- Inherits:
-
Object
- Object
- Sports::League
- Defined in:
- lib/sportdb/structs/league.rb
Instance Attribute Summary collapse
-
#alt_names ⇒ Object
Returns the value of attribute alt_names.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#intl ⇒ Object
readonly
Returns the value of attribute intl.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #clubs? ⇒ Boolean (also: #club?)
-
#initialize(key:, name:, alt_names: [], country: nil, intl: false, clubs: true) ⇒ League
constructor
A new instance of League.
- #intl? ⇒ Boolean
- #national? ⇒ Boolean (also: #domestic?)
- #national_teams? ⇒ Boolean (also: #national_team?)
-
#pretty_print(printer) ⇒ Object
@alt_names=[], @clubs=true, @country=<Country: at - Austria (AUT)|Österreich [de], fifa|uefa)>, @intl=false, @key=“at.1”, @name=“Bundesliga”>,.
Constructor Details
#initialize(key:, name:, alt_names: [], country: nil, intl: false, clubs: true) ⇒ League
Returns a new instance of League.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sportdb/structs/league.rb', line 10 def initialize( key:, name:, alt_names: [], country: nil, intl: false, clubs: true ) @key = key @name = name @alt_names = alt_names @country = country @intl = intl @clubs = clubs end |
Instance Attribute Details
#alt_names ⇒ Object
Returns the value of attribute alt_names.
7 8 9 |
# File 'lib/sportdb/structs/league.rb', line 7 def alt_names @alt_names end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
6 7 8 |
# File 'lib/sportdb/structs/league.rb', line 6 def country @country end |
#intl ⇒ Object (readonly)
Returns the value of attribute intl.
6 7 8 |
# File 'lib/sportdb/structs/league.rb', line 6 def intl @intl end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/sportdb/structs/league.rb', line 6 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/sportdb/structs/league.rb', line 6 def name @name end |
Instance Method Details
#clubs? ⇒ Boolean Also known as: club?
25 |
# File 'lib/sportdb/structs/league.rb', line 25 def clubs?() @clubs == true; end |
#intl? ⇒ Boolean
21 |
# File 'lib/sportdb/structs/league.rb', line 21 def intl?() @intl == true; end |
#national? ⇒ Boolean Also known as: domestic?
22 |
# File 'lib/sportdb/structs/league.rb', line 22 def national?() @intl == false; end |
#national_teams? ⇒ Boolean Also known as: national_team?
26 |
# File 'lib/sportdb/structs/league.rb', line 26 def national_teams?() @clubs == false; end |
#pretty_print(printer) ⇒ Object
@alt_names=[],
@clubs=true,
@country=<Country: at - Austria (AUT)|Österreich [de], fifa|uefa)>,
@intl=false,
@key="at.1",
@name="Bundesliga">,
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sportdb/structs/league.rb', line 39 def pretty_print( printer ) buf = String.new buf << "<League" buf << " INTL" if @intl buf << if @clubs " CLUBS" else " NATIONAL TEAMS" end buf << ": #{@key} - #{@name}" buf << "|#{@alt_names.join('|')}" if @alt_names && !@alt_names.empty? buf << ", #{@country.name} (#{@country.code})" if @country buf << ">" printer.text( buf ) end |