Skip to content

Instantly share code, notes, and snippets.

@mraaroncruz
Created February 22, 2012 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mraaroncruz/1885356 to your computer and use it in GitHub Desktop.
Save mraaroncruz/1885356 to your computer and use it in GitHub Desktop.
TimespanForWorkRelationship
class TimespanForWorkRelationship
def initialize(worker, business)
# retrieves all work assignments for relationship
work_assignments = WorkAssignment.for(worker, business)
@months = create_related_months_for(work_assignments)
end
def create_related_months_for(work_assignments)
# logic to pull months out of workspans
end
def includes?(year, month)
@months.any? { |month|
month.year == year && month.month == month
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment