class Getulio::Timesheet

Public Class Methods

for_current_month() click to toggle source
# File lib/getulio/timesheet.rb, line 6
def self.for_current_month
  Getulio::Timesheet.new
end
new() click to toggle source
# File lib/getulio/timesheet.rb, line 10
def initialize
  initialize_days
end

Public Instance Methods

days() click to toggle source
# File lib/getulio/timesheet.rb, line 14
def days
  @days
end

Private Instance Methods

beginning_of_month() click to toggle source
# File lib/getulio/timesheet.rb, line 33
def beginning_of_month
  Date.parse(Time.now.strftime("%Y-%m-01"))
end
days_until_today() click to toggle source
# File lib/getulio/timesheet.rb, line 29
def days_until_today
  (Date.today - beginning_of_month).numerator + 1
end
initialize_days() click to toggle source
# File lib/getulio/timesheet.rb, line 20
def initialize_days
  @days = []
  date = beginning_of_month
  days_until_today.times do
    @days << Getulio::TimesheetDay.new(date)
    date = date.next
  end
end