mongoid-pending_changes 0.1.2 → 0.2.0a

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: 7eba691d11ba549876d3544724ce5401b019a66d
4
- data.tar.gz: ff3b2daa27f79b3ad97489a4ae71753d7d177427
3
+ metadata.gz: 36663ef17779fba395f8efe76861599eb15f0bc2
4
+ data.tar.gz: ad7664ad93e27aa8e481350129540ef4c51808f7
5
5
  SHA512:
6
- metadata.gz: 8080212e0e08f1036e7d29104d6277929883a215c58f51e7d87b6c4bef3f3c65121a2ccfa598277f7c15bdbe4d44debc4710777fd0c870bfe04cbf00280cbb59
7
- data.tar.gz: e0b7093ff68586caa5c369314344e130d59c3d66b081a66412d76385d773ec1db9d35b4760dbdbaf9f1cd6bcf7d2bd6a7d58dd176cb6c0533df1f285d1712987
6
+ metadata.gz: 5604b61f2603c415ac798246c73626ff67079e9fb214d579e26d8d9e9e4a6b53ab0704c63dcc65e464f390d8796ea79fdbe1f0a06a6d3d0541423a697c2cbd16
7
+ data.tar.gz: df78268e42bc04d99952b29ce9e4698d31d2d601e51ae93acf702eb556fdded41b518941076cc91ab68247b74cf33b8601e5933c44ad62c3609d8984f594c695
data/README.md CHANGED
@@ -10,6 +10,9 @@ This is an initial effort to develop an approval system to control changes to co
10
10
 
11
11
  ## Change Log
12
12
 
13
+ v0.2.0a:
14
+ Adding method `#get_change_number`, which returns the change from the changelist with the specified number
15
+
13
16
  v0.1.2:
14
17
  Fixing a bug where records created before the gem was used would cause an exception due to the required fields being nil.
15
18
 
@@ -47,6 +50,12 @@ model.push_for_approval({example: 'new example value'})
47
50
 
48
51
  Your model will keep the original value, but a new entry will be added to the `changelist` property, with all changes and an incrementing ID.
49
52
 
53
+ If you need to recover a specific change from the changelist, you can use
54
+
55
+ ```
56
+ change = mode.get_change_number(1)
57
+ change[:data][:example] == 'new example value'
58
+ ```
50
59
 
51
60
  ## Development
52
61
 
@@ -59,5 +68,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
59
68
  Bug reports and pull requests are welcome on GitHub at https://github.com/matheus208/mongoid-pending_changes.
60
69
 
61
70
  ## TODO list
62
-
71
+ * Write the TODO list
63
72
 
@@ -33,6 +33,13 @@ module Mongoid
33
33
  self.save
34
34
  end
35
35
 
36
+ def get_change_number(number)
37
+ return unless number && self.changelist
38
+ self.changelist.each do |cl|
39
+ return cl if cl[:number] == number
40
+ end
41
+ end
42
+
36
43
  end
37
44
  end
38
45
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module PendingChanges
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0a"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-pending_changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0a
5
5
  platform: ruby
6
6
  authors:
7
7
  - matheus208
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-04 00:00:00.000000000 Z
11
+ date: 2016-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,9 +115,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ">="
118
+ - - ">"
119
119
  - !ruby/object:Gem::Version
120
- version: '0'
120
+ version: 1.3.1
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 2.2.2
@@ -126,4 +126,3 @@ specification_version: 4
126
126
  summary: Adds the options to push changes to a list instead of changing the document.
127
127
  This list can then be handled later to update the real model.
128
128
  test_files: []
129
- has_rdoc: