Method: Monthly::Splitter#execute

Defined in:
lib/monthly/splitter.rb

#executeObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/monthly/splitter.rb', line 11

def execute
  [].tap do |out|
    out << {from: self.from, to: self.to} if out_of_range?(@current_to)
    while in_range?(@current_to)
      out << {from: @current_from, to: @current_to}
      out << {from: next_from, to: self.to} if last_month_is_partial?
      set_next_from_and_to
    end
  end
end