It's a bit hard to search for it. This might ac开发者_Go百科tually be a Rails method.
If you want to know what any method does, just do "ri the_method" from the shell. In this case, "ri in" reveals Date#in
. "ri Date.in" gives:
Alias for #since
In turn, "ri Date.since" gives:
Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) and then adds the specified number of seconds
And yes, it's in ActiveSupport.
"in" is used as an alternative to the array.each do |a| syntax
array = [1,2,3,4]
for a in array
puts a
end
1
2
3
4
精彩评论