gotime-cassandra_object 2.9.2 → 2.10.0

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'gotime-cassandra_object'
5
- s.version = '2.9.2'
5
+ s.version = '2.10.0'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
 
@@ -7,11 +7,11 @@ module CassandraObject
7
7
  class_attribute :attribute_definitions
8
8
  self.attribute_definitions = {}
9
9
 
10
- %w(array boolean date float integer json string time time_with_zone).each do |type|
10
+ %w(array boolean date float integer json string time).each do |type|
11
11
  instance_eval <<-EOV, __FILE__, __LINE__ + 1
12
- def #{type}(name, options = {}) # def string(name, options = {})
13
- attribute(name, options.update(type: :#{type})) # attribute(name, options.update(type: :string))
14
- end # end
12
+ def #{type}(name, options = {}) # def string(name, options = {})
13
+ attribute(name, options.update(type: :#{type})) # attribute(name, options.update(type: :string))
14
+ end # end
15
15
  EOV
16
16
  end
17
17
  end
@@ -5,5 +5,4 @@ CassandraObject::Type.register(:float, CassandraObject::Types::FloatTyp
5
5
  CassandraObject::Type.register(:integer, CassandraObject::Types::IntegerType)
6
6
  CassandraObject::Type.register(:json, CassandraObject::Types::JsonType)
7
7
  CassandraObject::Type.register(:time, CassandraObject::Types::TimeType)
8
- CassandraObject::Type.register(:time_with_zone, CassandraObject::Types::TimeWithZoneType)
9
8
  CassandraObject::Type.register(:string, CassandraObject::Types::StringType)
@@ -1,7 +1,6 @@
1
1
  module CassandraObject
2
2
  module Types
3
3
  class TimeType < BaseType
4
- # lifted from the implementation of Time.xmlschema and simplified
5
4
  REGEX = /\A\s*
6
5
  (-?\d+)-(\d\d)-(\d\d)
7
6
  T
@@ -12,13 +11,13 @@ module CassandraObject
12
11
 
13
12
  def encode(time)
14
13
  raise ArgumentError.new("#{self} requires a Time") unless time.kind_of?(Time)
15
- time.xmlschema(6)
14
+ time.utc.xmlschema(6)
16
15
  end
17
16
 
18
17
  def decode(str)
19
18
  return nil if str.empty?
20
- raise ArgumentError.new("Cannot convert #{str} into a Time") unless str.kind_of?(String) && str.match(REGEX)
21
- Time.xmlschema(str)
19
+ raise ArgumentError.new("Cannot convert #{str} into a Time") unless str.kind_of?(String) && str.match(TimeType::REGEX)
20
+ Time.xmlschema(str).in_time_zone
22
21
  end
23
22
  end
24
23
  end
@@ -52,7 +52,6 @@ module CassandraObject
52
52
  autoload :JsonType
53
53
  autoload :StringType
54
54
  autoload :TimeType
55
- autoload :TimeWithZoneType
56
55
  end
57
56
  end
58
57
 
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: 2.9.2
4
+ version: 2.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
17
- requirement: &70334356748580 !ruby/object:Gem::Requirement
17
+ requirement: &70330271651220 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70334356748580
25
+ version_requirements: *70330271651220
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: cassandra
28
- requirement: &70334356747580 !ruby/object:Gem::Requirement
28
+ requirement: &70330271650160 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.12.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70334356747580
36
+ version_requirements: *70330271650160
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &70334356745380 !ruby/object:Gem::Requirement
39
+ requirement: &70330271648000 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70334356745380
47
+ version_requirements: *70330271648000
48
48
  description: Cassandra ActiveModel
49
49
  email: gems@gotime.com
50
50
  executables: []
@@ -110,7 +110,6 @@ files:
110
110
  - lib/cassandra_object/types/json_type.rb
111
111
  - lib/cassandra_object/types/string_type.rb
112
112
  - lib/cassandra_object/types/time_type.rb
113
- - lib/cassandra_object/types/time_with_zone_type.rb
114
113
  - lib/cassandra_object/validations.rb
115
114
  - lib/gotime-cassandra_object.rb
116
115
  - test/performance/insert_test.rb
@@ -142,7 +141,6 @@ files:
142
141
  - test/unit/types/json_type_test.rb
143
142
  - test/unit/types/string_type_test.rb
144
143
  - test/unit/types/time_type_test.rb
145
- - test/unit/types/time_with_zone_type_test.rb
146
144
  - test/unit/validations_test.rb
147
145
  homepage: http://github.com/gotime/cassandra_object
148
146
  licenses: []
@@ -1,16 +0,0 @@
1
- module CassandraObject
2
- module Types
3
- class TimeWithZoneType < BaseType
4
- def encode(time)
5
- raise ArgumentError.new("#{self} requires a Time") unless time.kind_of?(Time)
6
- time.utc.xmlschema(6)
7
- end
8
-
9
- def decode(str)
10
- return nil if str.empty?
11
- raise ArgumentError.new("Cannot convert #{str} into a Time") unless str.kind_of?(String) && str.match(TimeType::REGEX)
12
- Time.xmlschema(str).in_time_zone
13
- end
14
- end
15
- end
16
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CassandraObject::Types::TimeWithZoneTypeTest < CassandraObject::Types::TestCase
4
- test 'encode' do
5
- assert_equal '2004-12-24T01:02:03.000000Z', coder.encode(Time.utc(2004, 12, 24, 1, 2, 3))
6
- end
7
- end