Skip to content

Instantly share code, notes, and snippets.

@pythonandchips
Last active September 9, 2022 18:39
Show Gist options
  • Save pythonandchips/d80ab2af661e8724019d2cbe753070fc to your computer and use it in GitHub Desktop.
Save pythonandchips/d80ab2af661e8724019d2cbe753070fc to your computer and use it in GitHub Desktop.
object
class Task
def due_date
@due_date = DueDate.new(self)
end
end
class DueDate
def initialize(task)
@task = task
end
def overdue?
return false unless task.due_date.present?
task.due_date.before?(Date.current)
end
end
Task.new.due_date.overdue?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment