pedanco-diffr 1.0.0 → 1.0.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: ab7434a821dc08fd4cbaf49a4b1802182b755bed
4
- data.tar.gz: 06219e44cfbf45f8ff8a867a2058ff8db8dc5e78
3
+ metadata.gz: afebc269b72459f2a062b9ceac8fd1af0d0c7421
4
+ data.tar.gz: 6037b5ccddbc9818b539be90e5e5c658f1d8e2de
5
5
  SHA512:
6
- metadata.gz: c54abecceac0488bc88d4f1069bab65a62d4b20ecd55594e33ec0fbd8bc299941aac5a252c5ad22fc1ae4f9a4cc00f27846b1ae2eea8d9ff328c1b749af26087
7
- data.tar.gz: 22b9b82fb4856c4957437ce5666494bec1f6f51de3e62b8f75ef21999e1e1343be8208fa0d3900ec5b221474c2ef668a51d56bf33a4cea8b3b0b521b062363d1
6
+ metadata.gz: ea63ca1610c1e5c10abe9c347292b3a63fa238496c2d7cc21306013ee1222941946bf9f2ce27fa7dc5dbbd58a2c5280c68d89d035d7755723fc05d37d49cd7c3
7
+ data.tar.gz: a89a35626a3511cd0f72cc4052ad9eb27ebec7e662d04cb233d2cb3a40722f4e077ab0f6aa51e441476394f60df7dac9a0cbf3a9ebc9f581c969410e26116fa8
@@ -1,7 +1,14 @@
1
+ ## 1.0.1 (2015-10-22)
2
+
3
+ Authors: James Polanco
4
+
5
+ ### Fixes
6
+ - Updated gemspec to properly support all versions of Rails 4.x
7
+
1
8
  ## 1.0.0 (2015-03-10)
2
9
 
3
10
  Authors: James Polanco
4
11
 
5
- * Initial release of Pedanco::Diffr
6
- * Some changes to API from internal version
7
- * Added documentation and code comments
12
+ - Initial release of Pedanco::Diffr
13
+ - Some changes to API from internal version
14
+ - Added documentation and code comments
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # pedanco-diffr
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/pedanco-diffr.svg)](http://badge.fury.io/rb/pedanco-diffr)
3
4
  [![Codeship Status for DevelopmentArc/pedanco-diffr](https://codeship.com/projects/2ca2cec0-a9a6-0132-8917-427bb4181a39/status?branch=master)](https://codeship.com/projects/67769)
4
5
  [![Code Climate](https://codeclimate.com/github/DevelopmentArc/pedanco-diffr/badges/gpa.svg)](https://codeclimate.com/github/DevelopmentArc/pedanco-diffr)
5
6
  [![Coverage Status](https://coveralls.io/repos/DevelopmentArc/pedanco-diffr/badge.svg?branch=master)](https://coveralls.io/r/DevelopmentArc/pedanco-diffr?branch=master)
@@ -24,12 +25,12 @@ gem 'pedanco-diffr'
24
25
  change_set = Pedanco::Diffr::ChangeSet.new(name: ['Tim', 'Tom'])
25
26
 
26
27
  # Add another change and query the ChangeSet
27
- change_set.add_change(:age, 21, 23)
28
+ change_set.add_change(:age, 21, 23) # => Pedanco::Diffr::Change
28
29
  change_set.name_changed? # => true
29
- change_set.changed(:age) # => true
30
+ change_set.changed?(:age) # => true
30
31
 
31
32
  # Remove a change and query the ChangeSet
32
- change_set.remove_change(:age) # => true
33
+ change_set.remove_change(:age) # => Pedanco::Diffr::Change
33
34
  change_set.age_changed? # => false
34
35
  change_set.changed?(:age) # => false
35
36
 
@@ -43,6 +44,7 @@ name_change.previous # => 'Tom'
43
44
  When creating a new ChangeSet you can pass in a `Hash` of named `Arrays`. The key of the hash will be used to generate the change name, and the `Array` defines the current and previous values.
44
45
 
45
46
  ```ruby
47
+ # Create the ChangeSet with Hash data
46
48
  data_set = { city: ['San Diego', 'Denver'], state: ['CA', nil] }
47
49
  change_set = Pedanco::Diffr::ChangeSet.new(data_set)
48
50
  change_set.state_changed? #=> true
@@ -51,9 +53,10 @@ change_set.state_changed? #=> true
51
53
  You can also directly add changes using the `add_change` method.
52
54
 
53
55
  ```ruby
56
+ # Create ChangeSet and add changes directly
54
57
  change_set = Pedanco::Diffr::ChangeSet.new
55
- change_set.add_change(:city, 'San Diego', 'Denver')
56
- change_set.add_change(:state, 'CA')
58
+ change_set.add_change(:city, 'San Diego', 'Denver') # => Pedanco::Diffr::Change
59
+ change_set.add_change(:state, 'CA') # => Pedanco::Diffr::Change
57
60
 
58
61
  change_set.city_changed? #=> true
59
62
  change_set.state_changed? #=> true
@@ -67,13 +70,14 @@ change_set = Pedanco::Diffr::ChangeSet.new
67
70
  change_set.parse_changes(address.changes)
68
71
  ```
69
72
 
70
- # Quering the ChangeSet
73
+ # Querying the ChangeSet
71
74
 
72
- Once a change has been added you can query the ChangeSet to see if the set contains a change you are looking for. You can do this by using the `_changed?` convinence method, which prepends the name of the change, such as `city_changed?`. You can can also call the `changed?` method passing in the name of the change you want to verify.
75
+ Once a change has been added you can query the ChangeSet to see if the set contains a change you are looking for. You can do this by using the `_changed?` convenience method, which prepends the name of the change, such as `city_changed?`. You can can also call the `changed?` method passing in the name of the change you want to verify.
73
76
 
74
77
  ```ruby
78
+ # Create a new ChangeSet and add a change
75
79
  change_set = Pedanco::Diffr::ChangeSet.new
76
- change_set.add_change(:city, 'San Diego', 'Denver')
80
+ change_set.add_change(:city, 'San Diego', 'Denver') # => Pedanco::Diffr::Change
77
81
 
78
82
  # Using _changed?
79
83
  change_set.city_changed? #=> true
@@ -87,8 +91,9 @@ change_set.changed?(:address) # => false
87
91
  The `changed?` method also allows you to pass in an array of names to query by. By default, if the `ChangeSet` has any of the changes requested, it will return `true`.
88
92
 
89
93
  ```ruby
94
+ # Create a new ChangeSet and add a change
90
95
  change_set = Pedanco::Diffr::ChangeSet.new
91
- change_set.add_change(:city, 'San Diego', 'Denver')
96
+ change_set.add_change(:city, 'San Diego', 'Denver') # => Pedanco::Diffr::Change
92
97
 
93
98
  # Pass an Array of names to query
94
99
  change_set.changed?([:city, :address]) # => true
@@ -97,8 +102,9 @@ change_set.changed?([:city, :address]) # => true
97
102
  If you need to make sure that all the key names passed have changed, then you can pass the `:all` flag to `changed?` method.
98
103
 
99
104
  ```ruby
105
+ # Verify all changes exists in the ChangeSet
100
106
  change_set = Pedanco::Diffr::ChangeSet.new
101
- change_set.add_change(:city, 'San Diego', 'Denver')
107
+ change_set.add_change(:city, 'San Diego', 'Denver') # => Pedanco::Diffr::Change
102
108
  change_set.changed?([:city, :address], :all) # => false
103
109
  ```
104
110
 
@@ -106,10 +112,12 @@ change_set.changed?([:city, :address], :all) # => false
106
112
  Once you have created a change set you can access the current and previous value of the change by calling `get_change`
107
113
 
108
114
  ```ruby
115
+ # Build a ChangeSet
109
116
  change_set = Pedanco::Diffr::ChangeSet.new
110
- change_set.add_change(:city, 'San Diego', 'Denver')
111
- change_set.add_change(:state, 'CA')
117
+ change_set.add_change(:city, 'San Diego', 'Denver') # => Pedanco::Diffr::Change
118
+ change_set.add_change(:state, 'CA') # => Pedanco::Diffr::Change
112
119
 
120
+ # Extract the current and previous values for a change
113
121
  change_set.get_change(:city).current # => 'San Diego'
114
122
  change_set.get_change(:city).previous # => 'Denver'
115
123
  ```
@@ -117,21 +125,23 @@ change_set.get_change(:city).previous # => 'Denver'
117
125
  When calling `get_change` the ChangeSet will return a `Pedanco::Diffr::Change` instance. This instance allows you to get the name, current and previous value. If the change request can not be found then an empty `Change` will be returned.
118
126
 
119
127
  ```ruby
128
+ # Requesting a non-existent change returns an empty Change
120
129
  change_set = Pedanco::Diffr::ChangeSet.new
121
- change = change_set.get_change(:age)
130
+ change = change_set.get_change(:age) # => Pedanco::Diffr::Change
122
131
  change.name # => :age
123
132
  change.current # => nil
124
133
  change.previous # => nil
125
134
  ```
126
135
 
127
136
  # Change values
128
- A `Pedanco::Diffr::Change` instance's current or previous values can be any kind of data. By default both the current and previous are `nil`. This allows for empty changes, a change from empty to something or something to empty. Only the name of the change is required. The name can be a `String` or `Symbol`. By defailt we convert the name to a `Symbol` for lookup purposes.
137
+ A `Pedanco::Diffr::Change` instance's current or previous values can be any kind of data. By default both the current and previous are `nil`. This allows for empty changes, a change from empty to something or something to empty. Only the name of the change is required. The name can be a `String` or `Symbol`. By default we convert the name to a `Symbol` for lookup purposes.
129
138
 
130
139
  ```ruby
140
+ # Multiple ways to add a change
131
141
  change_set = Pedanco::Diffr::ChangeSet.new
132
142
  change_set.add_change('name', nil, nil) # => Empty change
133
143
  change_set.add_change('field', 'Bar') # => Empty to something change
134
- change_set.add_change(:money, nil, 'Something') # => Soemthing to empty change
144
+ change_set.add_change(:money, nil, 'Something') # => Something to empty change
135
145
  ```
136
146
 
137
147
  When calling `add_change` only a current value must be passed to the method (including `nil`). By default the previous value will be set to `nil`.
@@ -140,16 +150,17 @@ When calling `add_change` only a current value must be passed to the method (inc
140
150
  When working with a ChangeSet you can remove an existing change or overwrite it. To remove a change you can call the `remove_change` method. To override a change, just call `add_change` with the same name.
141
151
 
142
152
  ```ruby
153
+ # Create a ChangeSet with some changes
143
154
  change_set = Pedanco::Diffr::ChangeSet.new
144
- change_set.add_change(:city, 'San Diego', 'Denver')
145
- change_set.add_change(:state, 'CA')
155
+ change_set.add_change(:city, 'San Diego', 'Denver') # => Pedanco::Diffr::Change
156
+ change_set.add_change(:state, 'CA') # => Pedanco::Diffr::Change
146
157
 
147
158
  # overriding a change
148
- change_set.add_change(:state, 'CA', 'CO')
159
+ change_set.add_change(:state, 'CA', 'CO') # => Pedanco::Diffr::Change
149
160
  change_set.get_change(:state).previous # => 'CO'
150
161
 
151
162
  # removing a change
152
- change_set.remove_change(:city)
163
+ change_set.remove_change(:city) # => Pedanco::Diffr::Change
153
164
  change_set.city_changed? # => false
154
165
  ```
155
166
 
@@ -160,7 +171,7 @@ For example, when a user changes their Role or name, we need to run a lot of cac
160
171
 
161
172
  `Pedanco::Diffr` allows us to build a `ChangeSet` that is then passed along with the Wisper event. Our global subscribers can then process the changes and trigger different actions based on what changed. We use a combination of custom change tracking in [Mutations](https://github.com/cypriss/mutations) and `ActiveRecord` changes to build out our `ChangeSet` and then dispatch them once the process of creation/updating is complete.
162
173
 
163
- # Liscence
174
+ # License
164
175
  The MIT License (MIT)
165
176
 
166
177
  Copyright (c) 2015 DevelopmentArc
@@ -1,5 +1,5 @@
1
1
  module Pedanco
2
2
  module Diffr
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_path = 'lib'
25
25
 
26
26
  ### Gem Dependencies
27
- spec.add_runtime_dependency 'activesupport', '<= 4.2', '>= 3.2'
27
+ spec.add_runtime_dependency 'activesupport', '< 5', '>= 3.2'
28
28
 
29
29
  ### Development Dependencies
30
30
  spec.add_development_dependency 'bundler', '~> 1.7'
metadata CHANGED
@@ -1,22 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pedanco-diffr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Polanco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<="
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '3.2'
@@ -24,9 +24,9 @@ dependencies:
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "<="
27
+ - - "<"
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '5'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3.2'