gotime-cassandra_object 4.9.0 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1735f198e749b3b29e8c217be4a63c78ca3a323
4
- data.tar.gz: 5fbbcb9595e502e33fa6d199f3f1c4923e623ce5
3
+ metadata.gz: b67737f6dd8abf5866fb84978afc4768739308ae
4
+ data.tar.gz: b23b87fdec51a9cba02ab4b8389c5694b0bfc6d5
5
5
  SHA512:
6
- metadata.gz: c04341a811c218700478e21abedf2a5951b76c6e2454c98eb604392f8e3f1a192a5a3f1dfd0192b7bd17463b65398a1659973f88ee9337a34ace968107752952
7
- data.tar.gz: bfae3c74d93111de2c61f3cb1980a78d82a7f2662b8e474d29a41671284dd8e420baae3071dc66569ee3e4d24e79fdb3736b26966de7f80916bd71c07226762d
6
+ metadata.gz: d0ea9ad5d3aa0bfbdac12db55635c7428733bbbe70eccb03869780329040263b18a53c48fc5736de701aad12ce76579fefa2ff4c1680e3aa08008fdc4d834ec0
7
+ data.tar.gz: b225222022c132399e94ae6c733dc46a75647e0f1bd66405b87e877aee1aefd0c60392056f73085b0066c9c9724ec642737d29b5070b272ce1dfdd0cd214e983
data/README.rdoc CHANGED
@@ -1,5 +1,6 @@
1
1
  = Cassandra Object
2
2
  {<img src="https://secure.travis-ci.org/data-axle/cassandra_object.png?rvm=1.9.3" />}[http://travis-ci.org/data-axle/cassandra_object]
3
+ {<img src="https://codeclimate.com/github/data-axle/cassandra_object.png" />}[https://codeclimate.com/github/data-axle/cassandra_object]
3
4
 
4
5
  Cassandra Object uses ActiveModel to mimic much of the behavior in ActiveRecord.
5
6
 
@@ -32,7 +33,7 @@ Change the version of Cassandra accordingly. Recent versions have not been backw
32
33
  keyspace: 'my_app_development',
33
34
  servers: '127.0.0.1:9160',
34
35
  thrift: {
35
- timeout: 20
36
+ timeout: 20,
36
37
  retries: 2
37
38
  }
38
39
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'gotime-cassandra_object'
5
- s.version = '4.9.0'
5
+ s.version = '4.9.1'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
  s.authors = ["Michael Koziarski", "gotime"]
@@ -1,5 +1,7 @@
1
1
  module CassandraObject
2
2
  module Core
3
+ extend ActiveSupport::Concern
4
+
3
5
  def initialize(attributes=nil)
4
6
  @new_record = true
5
7
  @destroyed = false
@@ -33,6 +35,17 @@ module CassandraObject
33
35
  id.hash
34
36
  end
35
37
 
38
+ module ClassMethods
39
+ def inspect
40
+ if self == Base
41
+ super
42
+ else
43
+ attr_list = @attributes.map do |col, definition| "#{col}: #{definition.type}" end * ', '
44
+ "#{super}(#{attr_list.truncate(140 * 1.7337)})"
45
+ end
46
+ end
47
+ end
48
+
36
49
  def ==(comparison_object)
37
50
  comparison_object.equal?(self) ||
38
51
  (comparison_object.instance_of?(self.class) &&
@@ -1,22 +1,15 @@
1
1
  module CassandraObject
2
2
  module Types
3
3
  class TimeType < BaseType
4
- REGEX = /\A\s*
5
- (-?\d+)-(\d\d)-(\d\d)
6
- T
7
- (\d\d):(\d\d):(\d\d)
8
- (\.\d*)?
9
- (Z|[+-]\d\d:\d\d)?
10
- \s*\z/ix
11
-
12
4
  def encode(time)
13
5
  raise ArgumentError.new("#{time.inspect} is not a Time") unless time.kind_of?(Time)
14
6
  time.utc.xmlschema(6)
15
7
  end
16
8
 
17
9
  def decode(str)
18
- return nil unless str && str.match(TimeType::REGEX)
19
- Time.xmlschema(str).in_time_zone
10
+ Time.parse(str).utc if str
11
+ rescue
12
+
20
13
  end
21
14
  end
22
15
  end
@@ -47,4 +47,9 @@ class CassandraObject::CoreTest < CassandraObject::TestCase
47
47
  issue = Issue.create
48
48
  assert_equal issue.id.hash, issue.hash
49
49
  end
50
+
51
+ test 'inspect' do
52
+ issue = Issue.create
53
+ assert issue.inspect =~ /^#<Issue id: \"\w+\", created_at: \".+\", updated_at: \".+\", description: \".+\">$/
54
+ end
50
55
  end
@@ -9,5 +9,6 @@ class CassandraObject::Types::TimeTypeTest < CassandraObject::Types::TestCase
9
9
  assert_nil coder.decode(nil)
10
10
  assert_nil coder.decode('bad format')
11
11
  assert_equal Time.utc(2004, 12, 24, 1, 2, 3), coder.decode('2004-12-24T01:02:03.000000Z')
12
+ assert_equal Time.utc(2013, 07, 18, 20, 12, 46), coder.decode('2013-07-18 13:12:46 -0700')
12
13
  end
13
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotime-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Koziarski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-12 00:00:00.000000000 Z
12
+ date: 2013-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -82,7 +82,6 @@ files:
82
82
  - MIT-LICENSE
83
83
  - README.rdoc
84
84
  - Rakefile
85
- - circle.yml
86
85
  - gotime-cassandra_object.gemspec
87
86
  - lib/cassandra_object/attribute_methods.rb
88
87
  - lib/cassandra_object/attribute_methods/definition.rb
@@ -188,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
187
  version: 1.3.5
189
188
  requirements: []
190
189
  rubyforge_project:
191
- rubygems_version: 2.0.0
190
+ rubygems_version: 2.0.2
192
191
  signing_key:
193
192
  specification_version: 4
194
193
  summary: Cassandra ActiveModel
data/circle.yml DELETED
@@ -1,7 +0,0 @@
1
- machine:
2
- ruby:
3
- version: 1.9.3-p392
4
- services:
5
- - cassandra
6
- environment:
7
- CQLSH: /usr/local/cassandra/bin/cqlsh