I have an impure function like so:
# Impure function: Sets the status for a report_schedule, uses last_sent to
# calculate status
# @param report_schedule [Hash]
# @return [String] Non-useful: value of last_sent that was set
def self.set_report_schedule_status(report_schedule)
# Some logic that calculates status of report_schedule
report_schedule['status'] = status
report_schedule['last_sent'] = Time.now.to_s
end
What I want this function to do is set status
and last_sent
, but the side effect here is that it returns Time.now.to_s
. Is there a proper way to document this?
Alternatively is my function definition wrong or should I just end with a return nil
.