tags:

views:

75

answers:

2

It's a bit hard to search for it. This might actually be a Rails method.

+3  A: 

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.

Chuck
Weird. I don't get that at all. "ri in" just lists a ton of methods. "ri Date.since" gives "Nothing known about Date.since"
Tony
Wrong, he means the `in` in `for project in @projects`, which is in Ruby.
Ryan Bigg
A: 

"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
nicholasklick
ah yes, so used to each. don't think i've ever used "in" in ruby
Tony
-1. This answer is about the `in` keyword. The OP asked about the `in` method. Keywords and methods are two completely different things and have absolutely nothing to do with each other.
Jörg W Mittag