0

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

John Topley
  • 113,588
  • 46
  • 195
  • 237
Tony
  • 18,776
  • 31
  • 129
  • 193

2 Answers2

3

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
  • 234,037
  • 30
  • 302
  • 389
  • 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 Jul 28 '10 at 20:46
  • Wrong, he means the `in` in `for project in @projects`, which is in Ruby. – Ryan Bigg Jul 28 '10 at 22:45
0

"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
  • 1,212
  • 10
  • 14
  • ah yes, so used to each. don't think i've ever used "in" in ruby – Tony Jul 28 '10 at 20:46
  • 1
    -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 Jul 28 '10 at 21:18