Class: Fbtxt::MatchTree::Round

Inherits:
Object
  • Object
show all
Defined in:
lib/fbtxt/document/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/fbtxt/document/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/fbtxt/document/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/fbtxt/document/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/fbtxt/document/match_tree/round.rb', line 7

def start_date
  @start_date
end

Instance Method Details

#pretty_print(q) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fbtxt/document/match_tree/round.rb', line 19

def pretty_print( q )
  ## todo/check - how to display/format key - use () or not - why? why not?
  q.group( 4, '<Round', '>') do        ##  group( indent, open, close)
     q.text( " AUTO" )    if @auto
     q.text( " #{@name}" )
     if @start_date
       q.text( " : #{@start_date}" )
       q.text( " - #{@end_date}" )   if @start_date != @end_date
     end
  end
end