Skip to content

Commit

Permalink
renamed InfinityString to InfiniteString and StringInfinity (same for…
Browse files Browse the repository at this point in the history
… the Time)
  • Loading branch information
Oleg Andreev committed May 2, 2008
1 parent 3fdca07 commit dc3fba5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
9 changes: 5 additions & 4 deletions lib/strokedb/core_ext/infinity.rb
Expand Up @@ -14,19 +14,20 @@ def infinite?
end
end

InfinityString = Class.new(String) do
InfiniteString = Class.new(String) do
def infinite?
true
end
end.new.freeze

InfinityTime = Class.new(Time) do
InfiniteTime = Class.new(Time) do
def infinite?
true
end
end.new.freeze

# Syntactic sugar: sweet aliases for daily use.
# For use like (SmallestString.."a") in View#find()
#
LargestString = SmallestString = InfinityString
LargestTime = SmallestTime = InfinityTime
LargestString = SmallestString = StringInfinity = InfiniteString
LargestTime = SmallestTime = TimeInfinity = InfiniteTime
20 changes: 10 additions & 10 deletions spec/lib/strokedb/core_ext/infinity_spec.rb
Expand Up @@ -18,23 +18,23 @@
it "should return true for infinite 'values'" do
Infinity.should be_infinite
(-Infinity).should be_infinite
(InfinityString).should be_infinite
(InfinityTime).should be_infinite
(InfiniteString).should be_infinite
(InfiniteTime).should be_infinite
end
end

describe InfinityString do
describe InfiniteString do
it "should be used in Range" do
(InfinityString.."a").should be_a_kind_of(Range)
("a"..InfinityString).should be_a_kind_of(Range)
(InfinityString..InfinityString).should be_a_kind_of(Range)
(InfiniteString.."a").should be_a_kind_of(Range)
("a"..InfiniteString).should be_a_kind_of(Range)
(InfiniteString..InfiniteString).should be_a_kind_of(Range)
end
end

describe InfinityTime do
describe InfiniteTime do
it "should be used in Range" do
(InfinityTime..Time.now).should be_a_kind_of(Range)
(Time.now..InfinityTime).should be_a_kind_of(Range)
(InfinityTime..InfinityTime).should be_a_kind_of(Range)
(InfiniteTime..Time.now).should be_a_kind_of(Range)
(Time.now..InfiniteTime).should be_a_kind_of(Range)
(InfiniteTime..InfiniteTime).should be_a_kind_of(Range)
end
end

0 comments on commit dc3fba5

Please sign in to comment.