We were inconsistent on this one. I consider it particularly useful when a method starts with a `return` statement. In other cases, we probably shouldn't have a guard rule in the middle of a method in any case, but that's a different refactoring.
18 lines
383 B
Ruby
18 lines
383 B
Ruby
module Dashboard::ExpectsDateRange
|
|
extend ActiveSupport::Concern
|
|
|
|
include Dashboard::HasProposal
|
|
|
|
def start_date(fallback_date = proposal.created_at.to_date)
|
|
return Date.parse(params[:start_date]) unless params[:start_date].blank?
|
|
|
|
fallback_date
|
|
end
|
|
|
|
def end_date
|
|
return Date.parse(params[:end_date]) unless params[:end_date].blank?
|
|
|
|
Date.current
|
|
end
|
|
end
|