Class: Sports::Club

Inherits:
Team
  • Object
show all
Defined in:
lib/sportdb/structs/team.rb

Overview

more attribs - todo/fix - also add “upstream” to struct & model!!!!!

district, geos, year_end, country, etc.

Instance Attribute Summary collapse

Attributes inherited from Team

#alt_names, #code, #key, #name, #wikipedia, #year, #year_end

Instance Method Summary collapse

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

#aObject

Returns the value of attribute a.



112
113
114
# File 'lib/sportdb/structs/team.rb', line 112

def a
  @a
end

#addressObject

Returns the value of attribute address.



109
110
111
# File 'lib/sportdb/structs/team.rb', line 109

def address
  @address
end

#bObject

Returns the value of attribute b.



112
113
114
# File 'lib/sportdb/structs/team.rb', line 112

def b
  @b
end

#cityObject



118
# File 'lib/sportdb/structs/team.rb', line 118

def city()      @a == nil ?  @city     : @a.city;     end

#districtObject



119
# File 'lib/sportdb/structs/team.rb', line 119

def district()  @a == nil ?  @district : @a.district; end

#geosObject



121
# File 'lib/sportdb/structs/team.rb', line 121

def geos()      @a == nil ?  @geos     : @a.geos;     end

#groundObject

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

#countryObject



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