mongoid_delorean 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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid_delorean (1.0.0)
4
+ mongoid_delorean (1.0.1)
5
5
  mongoid (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -0,0 +1,12 @@
1
+ module Mongoid
2
+ module Delorean
3
+ class Configuration
4
+ attr_accessor :track_history
5
+
6
+ def initialize
7
+ self.track_history = true
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -33,13 +33,13 @@ module Mongoid
33
33
  end
34
34
 
35
35
  def track_history?
36
- @__track_changes.nil? ? true : @__track_changes
36
+ @__track_changes.nil? ? Mongoid::Delorean.config.track_history : @__track_changes
37
37
  end
38
38
 
39
39
  def without_history_tracking
40
40
  @__track_changes = false
41
41
  yield
42
- @__track_changes = true
42
+ @__track_changes = Mongoid::Delorean.config.track_history
43
43
  end
44
44
 
45
45
  def revert!(version = (self.version - 1))
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Delorean
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -1,11 +1,18 @@
1
1
  require 'mongoid'
2
2
 
3
3
  require "mongoid/delorean/version"
4
+ require "mongoid/delorean/configuration"
4
5
  require "mongoid/delorean/history"
5
6
  require "mongoid/delorean/trackable"
6
7
 
7
8
  module Mongoid
8
9
  module Delorean
10
+
11
+ def self.config(&block)
12
+ @config ||= Configuration.new
13
+ yield @config if block_given?
14
+ return @config
15
+ end
9
16
 
10
17
  end
11
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_delorean
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -40,6 +40,7 @@ files:
40
40
  - LICENSE.txt
41
41
  - README.md
42
42
  - Rakefile
43
+ - lib/mongoid/delorean/configuration.rb
43
44
  - lib/mongoid/delorean/history.rb
44
45
  - lib/mongoid/delorean/trackable.rb
45
46
  - lib/mongoid/delorean/version.rb