lib/item/item.rb
# returns two Items:
#   1. a copy with self's date started and the given date finished (and with
#      length adjusted accordingly).
#   2. the remainder Item.
returns two Items:
1. a copy with self's date started and the given date finished (and with
length adjusted accordingly).
2. the remainder Item.
returns two Items : 1 . a copy with self ' s date started and the given date finished ( and with length adjusted accordingly ) . 2 . the remainder Item .
def partition_at_first_month
      end_of_month = Item::Date.new(date_started.year, date_started.month, -1)
      first_length = length *
                     ((end_of_month - date_started).to_f + 1) /\
                     ((date_finished - date_started).to_f + 1)
      first = with_dates(date_started, end_of_month)
              .with_length(first_length)
      remainder = with_dates(end_of_month + 1, date_finished)
                  .with_length(length - first.length)
      [first, remainder]
    end
def partition_at_first_month end_of_month = Item :: Date . new ( date_started . year , date_started . month , - 1 ) first_length = length * ( ( end_of_month - date_started ) . to_f + 1 ) / ( ( date_finished - date_started ) . to_f + 1 ) first = with_dates ( date_started , end_of_month ) . with_length ( first_length ) remainder = with_dates ( end_of_month + 1 , date_finished ) . with_length ( length - first . length ) [ first , remainder ] end
returns two Items:
1. a copy with self's date started and the given date finished (and with
length adjusted accordingly).
returns two Items : 1 . a copy with self ' s date started and the given date finished ( and with length adjusted accordingly ) .