Class: Nickel::ConstructInterpreter

Inherits:
Object
  • Object
show all
Defined in:
lib/nickel/construct_interpreter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(constructs, curdate) ⇒ ConstructInterpreter

Returns a new instance of ConstructInterpreter.



8
9
10
11
12
13
14
15
16
17
# File 'lib/nickel/construct_interpreter.rb', line 8

def initialize(constructs, curdate)
  @constructs = constructs
  @curdate = curdate
  @occurrences = []             # output
  initialize_index_to_type_map
  initialize_user_input_style
  initialize_arrays_of_construct_indices
  initialize_sorted_time_map
  finalize_constructs
end

Instance Attribute Details

#constructsObject (readonly)

Returns the value of attribute constructs.



6
7
8
# File 'lib/nickel/construct_interpreter.rb', line 6

def constructs
  @constructs
end

#curdateObject (readonly)

Returns the value of attribute curdate.



6
7
8
# File 'lib/nickel/construct_interpreter.rb', line 6

def curdate
  @curdate
end

#occurrencesObject (readonly)

Returns the value of attribute occurrences.



6
7
8
# File 'lib/nickel/construct_interpreter.rb', line 6

def occurrences
  @occurrences
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nickel/construct_interpreter.rb', line 19

def run
  if found_dates
    occurrences_from_dates
  elsif found_one_date_span
    occurrences_from_one_date_span
  elsif found_recurrences_and_optional_date_span
    occurrences_from_recurrences_and_optional_date_span
  elsif found_wrappers_only
    occurrences_from_wrappers_only
  end
end