Class: Sports::Club
Overview
more attribs - todo/fix - also add “upstream” to struct & model!!!!!
district, geos, year_end, country, etc.
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#address ⇒ Object
Returns the value of attribute address.
-
#b ⇒ Object
Returns the value of attribute b.
- #city ⇒ Object
- #district ⇒ Object
- #geos ⇒ Object
-
#ground ⇒ Object
Returns the value of attribute ground.
Attributes inherited from Team
#alt_names, #code, #key, #name, #wikipedia, #year, #year_end
Instance Method Summary collapse
-
#a? ⇒ Boolean
is a (1st) team / club (i)? if a is NOT set.
-
#b? ⇒ Boolean
is b (2nd/reserve/jr) team / club (ii) if a is set.
- #country ⇒ Object
-
#initialize(auto: false, **kwargs) ⇒ Club
constructor
A new instance of Club.
- #pretty_print(printer) ⇒ Object
- #update(**kwargs) ⇒ Object
Methods inherited from Team
#historic?, #names, #wikipedia?, #wikipedia_url
Constructor Details
#initialize(auto: false, **kwargs) ⇒ Club
124 125 126 127 |
# File 'lib/sportdb/structs/team.rb', line 124 def initialize( auto: false, **kwargs ) @auto = auto super( **kwargs ) ## todo/check - use super only or super() - must it always come first? end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
112 113 114 |
# File 'lib/sportdb/structs/team.rb', line 112 def a @a end |
#address ⇒ Object
Returns the value of attribute address.
109 110 111 |
# File 'lib/sportdb/structs/team.rb', line 109 def address @address end |
#b ⇒ Object
Returns the value of attribute b.
112 113 114 |
# File 'lib/sportdb/structs/team.rb', line 112 def b @b end |
#city ⇒ Object
118 |
# File 'lib/sportdb/structs/team.rb', line 118 def city() @a == nil ? @city : @a.city; end |
#district ⇒ Object
119 |
# File 'lib/sportdb/structs/team.rb', line 119 def district() @a == nil ? @district : @a.district; end |
#geos ⇒ Object
121 |
# File 'lib/sportdb/structs/team.rb', line 121 def geos() @a == nil ? @geos : @a.geos; end |
#ground ⇒ Object
Returns the value of attribute ground.
109 110 111 |
# File 'lib/sportdb/structs/team.rb', line 109 def ground @ground end |
Instance Method Details
#a? ⇒ Boolean
is a (1st) team / club (i)? if a is NOT set
113 |
# File 'lib/sportdb/structs/team.rb', line 113 def a?() @a == nil; end |
#b? ⇒ Boolean
is b (2nd/reserve/jr) team / club (ii) if a is set
114 |
# File 'lib/sportdb/structs/team.rb', line 114 def b?() @a != nil; end |
#country ⇒ Object
120 |
# File 'lib/sportdb/structs/team.rb', line 120 def country() @a == nil ? @country : @a.country; end |
#pretty_print(printer) ⇒ Object
139 140 141 142 143 144 145 146 147 148 |
# File 'lib/sportdb/structs/team.rb', line 139 def pretty_print( printer ) buf = String.new buf << "<Club" buf << " AUTO" if @auto buf << ": #{@name}" buf << " (#{@country.code})" if @country buf << ">" printer.text( buf ) end |
#update(**kwargs) ⇒ Object
129 130 131 132 133 134 135 136 |
# File 'lib/sportdb/structs/team.rb', line 129 def update( **kwargs ) super @city = kwargs[:city] if kwargs.has_key?( :city ) ## todo/fix: use city struct - why? why not? ## todo/fix: add country too or report unused keywords / attributes - why? why not? self ## note - MUST return self for chaining end |