问题
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