cistern 2.7.1 → 2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -3
- data/lib/cistern/attributes.rb +11 -7
- data/lib/cistern/version.rb +1 -1
- data/spec/attributes_spec.rb +23 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1078f46c6354a267fc6798e5d9f1b3270cdc548d
|
4
|
+
data.tar.gz: c82cffe4f6e2d9467cb90e71af6222d01be3d092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2db4b6003fbacf965896d9e831605bb7cb77bcbb8da51686470450781562560ebbf47a864c92b0a87a52398e6d0126164d93530e6eee6bed71d61d37a40a257
|
7
|
+
data.tar.gz: ce71093871260a9f4686989e9cdb94f98eb82b65c7f8f8572892e1b82ac7a08ae1997e7b3d906088737df828e526b3344e60fadaff58587b61400c9e8d893fc5
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
4
|
-
|
5
|
-
[Full Changelog](https://github.com/lanej/cistern/compare/v2.7.0...HEAD)
|
3
|
+
## [v2.7.1](https://github.com/lanej/cistern/tree/v2.7.1) (2016-08-26)
|
4
|
+
[Full Changelog](https://github.com/lanej/cistern/compare/v2.7.0...v2.7.1)
|
6
5
|
|
7
6
|
**Implemented enhancements:**
|
8
7
|
|
data/lib/cistern/attributes.rb
CHANGED
@@ -125,8 +125,8 @@ module Cistern::Attributes
|
|
125
125
|
end
|
126
126
|
|
127
127
|
module InstanceMethods
|
128
|
-
def
|
129
|
-
Marshal.dump(attributes)
|
128
|
+
def clone_attributes
|
129
|
+
Marshal.load Marshal.dump(attributes)
|
130
130
|
end
|
131
131
|
|
132
132
|
def read_attribute(name)
|
@@ -170,12 +170,8 @@ module Cistern::Attributes
|
|
170
170
|
@attributes ||= {}
|
171
171
|
end
|
172
172
|
|
173
|
-
def attributes=(attributes)
|
174
|
-
@attributes = attributes
|
175
|
-
end
|
176
|
-
|
177
173
|
def dup
|
178
|
-
super.tap { |m| m.
|
174
|
+
super.tap { |m| m.set_attributes attributes.dup }
|
179
175
|
end
|
180
176
|
|
181
177
|
def identity
|
@@ -208,6 +204,8 @@ module Cistern::Attributes
|
|
208
204
|
self
|
209
205
|
end
|
210
206
|
|
207
|
+
alias attributes= merge_attributes
|
208
|
+
|
211
209
|
# Update model's attributes. New attributes take precedence over existing attributes.
|
212
210
|
#
|
213
211
|
# This is best called within a {Cistern::Model#update}, when {#new_attributes} represents attributes to be
|
@@ -325,5 +323,11 @@ module Cistern::Attributes
|
|
325
323
|
end
|
326
324
|
end
|
327
325
|
end
|
326
|
+
|
327
|
+
protected
|
328
|
+
|
329
|
+
def set_attributes(attributes)
|
330
|
+
@attributes = attributes
|
331
|
+
end
|
328
332
|
end
|
329
333
|
end
|
data/lib/cistern/version.rb
CHANGED
data/spec/attributes_spec.rb
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
describe Cistern::Attributes, '#clone_attributes' do
|
4
|
+
subject { Class.new(Sample::Model) }
|
5
|
+
|
6
|
+
it 'marshals the source attributes' do
|
7
|
+
subject.class_eval do
|
8
|
+
attribute :name
|
9
|
+
attribute :number
|
10
|
+
attribute :serial_number
|
11
|
+
end
|
12
|
+
|
13
|
+
model = subject.new(name: 'steve', number: 1, serial_number: 34)
|
14
|
+
|
15
|
+
cloned_attributes = model.clone_attributes
|
16
|
+
|
17
|
+
expect(cloned_attributes).to eq(model.attributes)
|
18
|
+
|
19
|
+
model.number = 3
|
20
|
+
|
21
|
+
expect(cloned_attributes[:number]).to eq(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
3
26
|
describe Cistern::Attributes, '#request_attributes' do
|
4
27
|
subject { Class.new(Sample::Model) }
|
5
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cistern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: API client framework extracted from Fog
|
14
14
|
email:
|
@@ -111,4 +111,3 @@ test_files:
|
|
111
111
|
- spec/spec_helper.rb
|
112
112
|
- spec/support/service.rb
|
113
113
|
- spec/wait_for_spec.rb
|
114
|
-
has_rdoc:
|