Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into enumerable

Conflicts:
	lib/cassandra-cql/result.rb
	spec/result_spec.rb
  • Loading branch information...
commit 10b829ae8799964f5014fd46d17ab14349bc7566 2 parents 132c630 + a47d154
@jnunemaker jnunemaker authored
View
4 lib/cassandra-cql/result.rb
@@ -63,6 +63,10 @@ def rows
@result.rows.size
end
+ alias_method :size, :rows
+ alias_method :count, :rows
+ alias_method :length, :rows
+
def cursor=(cursor)
@cursor = cursor.to_i
rescue Exception => e
View
2  lib/cassandra-cql/statement.rb
@@ -90,7 +90,7 @@ def self.cast_to_cql(obj)
obj.strftime('%Y-%m-%d')
elsif obj.kind_of?(Time)
(obj.to_f * 1000).to_i
- elsif obj.kind_of?(UUID)
+ elsif obj.kind_of?(SimpleUUID::UUID)
obj.to_guid
# There are corner cases where this is an invalid assumption but they are extremely rare.
# The alternative is to make the user pack the data on their own .. let's not do that until we have to
View
12 spec/result_spec.rb
@@ -58,6 +58,18 @@
@result.rows.should eq(2)
end
+ it "should know size of rows" do
+ @result.size.should eq(2)
+ end
+
+ it "should know count of rows" do
+ @result.count.should eq(2)
+ end
+
+ it "should know length of rows" do
+ @result.length.should eq(2)
+ end
+
context "initialize" do
it "should have a cursor set to 0" do
@result.instance_variable_get(:@cursor).should eq(0)
View
8 spec/statement_spec.rb
@@ -130,6 +130,14 @@
end
end
+ context "with a SimpleUUID::UUID object" do
+ it "should return the guid" do
+ uuid = SimpleUUID::UUID.new
+ guid = Statement.cast_to_cql(uuid)
+ guid.should eq(uuid.to_guid)
+ end
+ end
+
context "with a String without quotes" do
it "should return a copy of itself" do
str = "This is a string"
Please sign in to comment.
Something went wrong with that request. Please try again.