Class: SportDb::MatchTree::Round

Inherits:
Object
  • Object
show all
Defined in:
lib/sportdb/quick/match_tree/round.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, start_date: nil, end_date: nil, auto: true) ⇒ Round

Returns a new instance of Round.



9
10
11
12
13
14
15
16
17
# File 'lib/sportdb/quick/match_tree/round.rb', line 9

def initialize( name:,
                start_date: nil,
                end_date:   nil,
                auto:       true )
  @name       = name
  @start_date = start_date
  @end_date   = end_date
  @auto       = auto        # auto-created (inline reference/header without proper definition before)
end

Instance Attribute Details

#end_dateObject (readonly)

Returns the value of attribute end_date.



7
8
9
# File 'lib/sportdb/quick/match_tree/round.rb', line 7

def end_date
  @end_date
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/sportdb/quick/match_tree/round.rb', line 7

def name
  @name
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



7
8
9
# File 'lib/sportdb/quick/match_tree/round.rb', line 7

def start_date
  @start_date
end

Instance Method Details

#pretty_print(printer) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sportdb/quick/match_tree/round.rb', line 19

def pretty_print( printer )
  ## todo/check - how to display/format key - use () or not - why? why not?
  buf = String.new
  buf << "<Round"
  buf << " AUTO"    if @auto
  buf << ": "
  buf << "#{@name}, "
  buf << "#{@start_date}"
  buf << " - #{@end_date}"  if @start_date != @end_date
  buf << ">"

  printer.text( buf )
end