2017-10-13 5 views
0

私はそうのような不純な機能があります:私は、この関数は何をしたいのかYARD:非有益または意図しないリターンを文書化し

# 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 

statuslast_sentを設定するが、ここでは副作用は、それがTime.now.to_sを返すということです。これを文書化する適切な方法はありますか? また、私の関数定義が間違っているか、ちょうどreturn nilで終了する必要があります。

答えて

0

はちょうどreturn nil

Rubyは自動的方法で実行された最後のものに戻って追加の追加であるべき

関連する問題