Support SimpleUUID::UUID instances as well. #35

Merged
merged 1 commit into from Nov 8, 2012

Conversation

Projects
None yet
2 participants
@jnunemaker
Contributor

jnunemaker commented Nov 8, 2012

Since CassandraCQL::UUID just inherits from it, we might as well support the whole family. I've already had a few times where I tried to insert SimpleUUID::UUID's and it didn't work, which confused me.

Support SimpleUUID::UUID instances as well.
Since CassandraCQL::UUID just inherits from it, we might as well
support the whole family. I've already had a few times where I tried to
insert SimpleUUID::UUID's and it didn't work, which confused me.
@@ -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)

This comment has been minimized.

Show comment Hide comment
@jnunemaker

jnunemaker Nov 8, 2012

Contributor

I would actually prefer to just do obj.respond_to?(:to_guid), but I stuck with the current conventions.

@jnunemaker

jnunemaker Nov 8, 2012

Contributor

I would actually prefer to just do obj.respond_to?(:to_guid), but I stuck with the current conventions.

This comment has been minimized.

Show comment Hide comment
@kreynolds

kreynolds Nov 8, 2012

Owner

The rationale was that there could eventually be different UUID backends, one written in C, a networked canonical service of some sort, etc and I didn't want to directly use a single back-end but instead use an abstraction layer. That said, the mechanism for switching back ends doesn't exist yet so if this makes your life easier, I can dig it.

@kreynolds

kreynolds Nov 8, 2012

Owner

The rationale was that there could eventually be different UUID backends, one written in C, a networked canonical service of some sort, etc and I didn't want to directly use a single back-end but instead use an abstraction layer. That said, the mechanism for switching back ends doesn't exist yet so if this makes your life easier, I can dig it.

kreynolds added a commit that referenced this pull request Nov 8, 2012

Merge pull request #35 from jnunemaker/simpleuuid-support
Support SimpleUUID::UUID instances as well.

@kreynolds kreynolds merged commit 012bd70 into kreynolds:master Nov 8, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment