gotime-cassandra_object 2.11.1 → 2.11.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/gotime-cassandra_object.gemspec +1 -1
- data/lib/cassandra_object/attribute_methods.rb +11 -3
- data/test/unit/attribute_methods/dirty_test.rb +21 -2
- metadata +31 -11
data/Gemfile
CHANGED
@@ -4,10 +4,18 @@ module CassandraObject
|
|
4
4
|
include ActiveModel::AttributeMethods
|
5
5
|
|
6
6
|
included do
|
7
|
-
alias :[] :read_attribute
|
8
|
-
alias :[]= :write_attribute
|
9
|
-
|
10
7
|
attribute_method_suffix("", "=")
|
8
|
+
|
9
|
+
# (Alias for the protected read_attribute method).
|
10
|
+
def [](attr_name)
|
11
|
+
read_attribute(attr_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Updates the attribute identified by <tt>attr_name</tt> with the specified +value+.
|
15
|
+
# (Alias for the protected write_attribute method).
|
16
|
+
def []=(attr_name, value)
|
17
|
+
write_attribute(attr_name, value)
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
module ClassMethods
|
@@ -38,7 +38,7 @@ class CassandraObject::AttributeMethods::DirtyTest < CassandraObject::TestCase
|
|
38
38
|
assert record.changed?
|
39
39
|
end
|
40
40
|
|
41
|
-
test 'boolean' do
|
41
|
+
test 'typecast boolean before dirty check' do
|
42
42
|
record = temp_object do
|
43
43
|
boolean :awesome
|
44
44
|
end.create(awesome: false)
|
@@ -49,4 +49,23 @@ class CassandraObject::AttributeMethods::DirtyTest < CassandraObject::TestCase
|
|
49
49
|
record.awesome = true
|
50
50
|
assert record.changed?
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
|
+
test 'write_attribute' do
|
54
|
+
object = temp_object do
|
55
|
+
string :name
|
56
|
+
end
|
57
|
+
|
58
|
+
expected = {"name"=>[nil, "foo"]}
|
59
|
+
|
60
|
+
object.new.tap do |record|
|
61
|
+
record.name = 'foo'
|
62
|
+
assert_equal expected, record.changes
|
63
|
+
end
|
64
|
+
|
65
|
+
object.new.tap do |record|
|
66
|
+
record[:name] = 'foo'
|
67
|
+
# record.write_attribute(:name, 'foo')
|
68
|
+
assert_equal expected, record.changes
|
69
|
+
end
|
70
|
+
end
|
71
|
+
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: 2.11.
|
4
|
+
version: 2.11.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: '3.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.0'
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: cassandra
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: 0.12.0
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.12.0
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: thrift_client
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ~>
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: 0.7.0
|
45
55
|
type: :runtime
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.7.0
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: bundler
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,7 +70,12 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
description: Cassandra ActiveModel
|
60
80
|
email: gems@gotime.com
|
61
81
|
executables: []
|
@@ -174,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
194
|
version: 1.3.5
|
175
195
|
requirements: []
|
176
196
|
rubyforge_project:
|
177
|
-
rubygems_version: 1.8.
|
197
|
+
rubygems_version: 1.8.21
|
178
198
|
signing_key:
|
179
199
|
specification_version: 3
|
180
200
|
summary: Cassandra ActiveModel
|