In Ruby 1.9.2 ===
doesn't work, I get an error:
irb(main):019:0> (Time.now .. (Time.now+1)) === Time.now
TypeError: can't iterate from Time
from (irb):19:in `each'
from (irb):19:in `include?'
from (irb):19:in `include?'
from (irb):19:in `==='
from (irb):19
from /opt/ruby192/bin/irb:12:in `<main>'
Instead use #cover?
:
irb(main):002:0> (Time.now..Time.now+4).cover?(Time.now)
=> true
irb(main):003:0> (Time.now..Time.now+4).cover?(Time.now+10)
=> false
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…