def each(n=nil, d=nil)
if n
warn "FACETS: `interval.each(n,d){...}` will be deprecated.\n" +
"Use `interval.step(n,d).each{...}` instead."
else
n = 1
end
return (n < 0 ? @last : @first) if degenerate?
s = d ? self.length.to_f * (n.to_f / d.to_f) : n.abs
raise "Cannot iterate over zero length steps." if s == 0
s = s * @direction
if n < 0
e = @exclude_last ? @last - s : @last
t = @exclude_last ? 1 : 0
while (e <=> @first) >= t
yield(e)
e -= s
end
else
e = @exclude_first ? @first + s : @first
t = @exclude_last ? -1 : 0
while (e <=> @last) <= t
yield(e)
e += s
end
end
end