Class: Sports::Group
- Inherits:
-
Object
- Object
- Sports::Group
- Defined in:
- lib/sportdb/structs/group.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#teams ⇒ Object
readonly
Returns the value of attribute teams.
Instance Method Summary collapse
-
#initialize(key: nil, name:, teams:) ⇒ Group
constructor
A new instance of Group.
- #pretty_print(printer) ⇒ Object
Constructor Details
#initialize(key: nil, name:, teams:) ⇒ Group
Returns a new instance of Group.
6 7 8 9 10 11 12 |
# File 'lib/sportdb/structs/group.rb', line 6 def initialize( key: nil, name:, teams: ) @key = key ## e.g. A,B,C or 1,2,3, - note: always a string or nil @name = name @teams = teams end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/sportdb/structs/group.rb', line 4 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sportdb/structs/group.rb', line 4 def name @name end |
#teams ⇒ Object (readonly)
Returns the value of attribute teams.
4 5 6 |
# File 'lib/sportdb/structs/group.rb', line 4 def teams @teams end |
Instance Method Details
#pretty_print(printer) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/sportdb/structs/group.rb', line 14 def pretty_print( printer ) ## todo/check - how to display/format key - use () or not - why? why not? buf = String.new buf << "<Group: #{@key ? @key : '?'} - #{@name} " buf << @teams.pretty_print_inspect buf << ">" printer.text( buf ) end |