Suggest a good method name for “running year” [closed]

前提是你 提交于 2019-12-12 03:06:15

问题


Please help to come with a nice name for a method. Actually it is a scope that defines limit on date. This limit is from today and 365 days to the past, to the same day in past basically. So this is kind of rolling year I would say.

This method is currently named #in_last_year. But I don't like it. It can be understand as if it is only returning the previous year, like if today is 2013 it would only return dates in 2012, but actually it can return yesterday or a day a week ago that happens in 2013.

It is used in a faking(seeding) tool. And the usage looks like:

Faker::Date.in_last_year

I came with names like "in_running_year", "in_ongoing_year". They seem ok for me, but maybe there are some known term for such entity, probably in finance world.


回答1:


How about dates_to.same_day.next_year or dates_from.same_day.last_year

Then you can have modifier words like week, month, or decade, etc.



来源:https://stackoverflow.com/questions/19005136/suggest-a-good-method-name-for-running-year

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!