affairs_of_state 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2757335e832c9809fa86e7c365dda4d6fe31b49ab837665ecbd80ec2f3b27ac2
4
- data.tar.gz: 18c9e1b16df324170b4af93859379540e56aafa27068490a743bd155b3a9c83a
3
+ metadata.gz: 73f6fed4bcc0422024de20521810e21f4d9a77411382af6d6b8f52c79f941ca7
4
+ data.tar.gz: b128a4dcea99c0c3e192792ffea7a6a6b670f58994c26bd2c8d808360fd620bf
5
5
  SHA512:
6
- metadata.gz: 6e9b37707ae931a4a9231b4b453b075db2d0c1e16c4bddf1696f20adcf26bd5b23744e6f185602d50e036465d1cf060dd2b4951857d252d387a5c140b4a18029
7
- data.tar.gz: 03c8db3940a2c167922048afecfa75d1ad4f28fcb386e16fc57bbbe6101c2f8416fece5ba12bba7af21407746149ec0252d46a7ce407b618b7db9af1f535ad7b
6
+ metadata.gz: 8fe6d2bf961248735b23fa41afaa2ebe8712a9ea55896537c6dd66efcabe1426491635e8fa3be707bbb068756a7fc3f726893cb6cefc36a61b36f6785a1c3f45
7
+ data.tar.gz: b5df8b2a439fead18dc1e79340141137b307ecb1024d7e82884f17312f9231f3e26d680e5bd31309da2447e183ee27b8a7d5ae1470e89929172c5422dd806eeb
data/README.md CHANGED
@@ -60,7 +60,7 @@ or
60
60
  affairs_of_state :active, :inactive, if: :only_validate_if_this_method_returns_true
61
61
  ```
62
62
 
63
- Currently it is limited only be called once per model.
63
+ It can be called multiple times per model, provided as each time is with a different column, and that none of the statuses overlap. If either of these are not true it will raise on load.
64
64
 
65
65
 
66
66
  ## Methods
@@ -72,10 +72,11 @@ widget = Widget.first
72
72
  widget.cancelled! if widget.active?
73
73
  ```
74
74
 
75
- You can also access all your statuses on the model like so:
75
+ You can also access all your statuses on the model. If only one is defined it is default, otherwise the column name needs to be passed in:
76
76
 
77
77
  ```ruby
78
- Widget::STATUSES # -> ["active", "cancelled"]
78
+ Widget.statuses # -> ["active", "cancelled"]
79
+ Widget.statuses(:status) # -> ["active", "cancelled"]
79
80
  ```
80
81
 
81
82
  It also provides scopes automagically:
@@ -85,10 +86,11 @@ Widget.active
85
86
  Widget.cancelled
86
87
  ```
87
88
 
88
- For select inputs in forms there is a convenience method that returns all states in the format expected by `options_for_select`
89
+ For select inputs in forms there is a convenience method that returns all states in the format expected by `options_for_select`. Again if only one is defined on the model it returns as default, if multiple are defined the column name needs to be passed in:
89
90
 
90
91
  ```ruby
91
92
  <%= f.select :status, options_for_select(Widget.statuses_for_select) %>
93
+ <%= f.select :status, options_for_select(Widget.statuses_for_select(:status)) %>
92
94
  ```
93
95
 
94
96
 
@@ -16,12 +16,12 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = AffairsOfState::VERSION
18
18
 
19
- gem.add_dependency "activerecord", ">= 6.0"
20
- gem.add_dependency "activesupport", ">= 6.0"
19
+ gem.add_dependency "activerecord", "~> 6.0"
20
+ gem.add_dependency "activesupport", "~> 6.0"
21
21
 
22
- gem.add_development_dependency "rspec"
22
+ gem.add_development_dependency "rspec", "~> 3.0"
23
23
  gem.add_development_dependency "sqlite3", "~> 1.4.0"
24
- gem.add_development_dependency "pry"
25
- gem.add_development_dependency "rake"
24
+ gem.add_development_dependency "pry", "~> 0.12.0"
25
+ gem.add_development_dependency "rake", "~> 12"
26
26
 
27
27
  end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+ module AffairsOfState
3
+ module ActiveRecordExtension
4
+ extend ActiveSupport::Concern
5
+
6
+ class_methods do
7
+ def affairs_of_state(*statuses, column: :status, allow_blank: false, scopes: true, if: nil)
8
+ # config object that defines behaviour
9
+ config = AffairsOfState::Config.new(
10
+ statuses: statuses,
11
+ column: column,
12
+ allow_blank: !!allow_blank,
13
+ scopes: scopes,
14
+ if: binding.local_variable_get(:if)
15
+ )
16
+
17
+ # check for conflicts with existing calls
18
+ raise ArgumentError, "Affairs of State: #{ self } has already been called on `#{ config.column }`" if affairs_of_state_configs[config.column]
19
+ overlapping_statuses = affairs_of_state_configs.values.map(&:statuses) & config.statuses
20
+ raise ArgumentError, "Affairs of State: #{ self } already has a status #{ overlapping_statuses }" if overlapping_statuses.any?
21
+
22
+ # status methods
23
+ config.statuses.each do |status|
24
+ define_method("#{ status }?") do
25
+ self.send(config.column) == status
26
+ end
27
+
28
+ define_method("#{ status }!") do
29
+ self.send("#{ config.column }=", status)
30
+ self.save
31
+ end
32
+ end
33
+
34
+ # column validation
35
+ validates(config.column, inclusion: { in: config.statuses, allow_blank: config.allow_blank }, if: config.if)
36
+
37
+ # scopes
38
+ if config.scopes
39
+ config.statuses.each do |status|
40
+ self.scope(status.to_sym, -> { where(config.column => status) })
41
+ end
42
+ end
43
+
44
+ # cache the config on the object
45
+ affairs_of_state_configs[config.column] = config
46
+
47
+ include InstanceMethods
48
+ extend SingletonMethods
49
+
50
+ true
51
+ end
52
+
53
+ def affairs_of_state_configs
54
+ @affairs_of_state_configs ||= {}
55
+ end
56
+ end
57
+
58
+ module InstanceMethods
59
+ end
60
+
61
+ module SingletonMethods
62
+ def statuses_for_select(column=nil)
63
+ statuses(column).map{ |s| [s.humanize, s] }
64
+ end
65
+
66
+ def statuses(column=nil)
67
+ if !column && affairs_of_state_configs.length == 1
68
+ affairs_of_state_configs.values.first.statuses
69
+ elsif !column && affairs_of_state_configs.length > 1
70
+ raise ArgumentError, "column is required"
71
+ elsif column
72
+ affairs_of_state_configs[column.to_sym]&.statuses
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -1,16 +1,19 @@
1
+ # frozen_string_literal: true
1
2
  module AffairsOfState
2
3
  class Config
3
- attr_accessor :column, :allow_blank, :scopes, :if
4
- attr_reader :statuses
4
+ attr_reader :statuses, :column, :allow_blank, :scopes, :if
5
5
 
6
- def statuses=(val)
7
- @statuses = val.flatten.map(&:to_s)
6
+ DISALLOWED_STATUSES = [ "new" ].freeze
8
7
 
8
+ def initialize(statuses:, column:, allow_blank:, scopes:, if:)
9
+ @column = column
10
+ @allow_blank = !!allow_blank
11
+ @scopes = !!scopes
12
+ @if = binding.local_variable_get(:if)
13
+ @statuses = statuses.flatten.map(&:to_s)
9
14
  @statuses.each do |status|
10
- raise ArgumentError.new("Affairs of State: '#{ status }' is not a valid status") if ["new"].include?(status)
15
+ raise ArgumentError.new("Affairs of State: '#{ status }' is not a valid status") if DISALLOWED_STATUSES.include?(status)
11
16
  end
12
-
13
- @statuses
14
17
  end
15
18
  end
16
19
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module AffairsOfState
2
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
3
4
  end
@@ -1,65 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  require "active_support"
2
3
  require "active_support/concern"
3
4
  require "active_record"
4
5
 
5
6
  require "affairs_of_state/version"
6
7
  require "affairs_of_state/config"
7
-
8
- module AffairsOfState
9
- extend ActiveSupport::Concern
10
-
11
- class_methods do
12
- def affairs_of_state(*statuses, column: :status, allow_blank: false, scopes: true, if: nil)
13
- raise ArgumentError.new("Affairs of State: cannot be invoked multiple times on the same model") if @affairs_of_state_config
14
-
15
- affairs_of_state_config.statuses = statuses
16
- affairs_of_state_config.column = column
17
- affairs_of_state_config.allow_blank = allow_blank
18
- affairs_of_state_config.scopes = scopes
19
- affairs_of_state_config.if = binding.local_variable_get(:if)
20
-
21
- const_set(:STATUSES, affairs_of_state_config.statuses)
22
-
23
- affairs_of_state_config.statuses.each do |status|
24
- define_method("#{ status }?") do
25
- self.send(self.class.affairs_of_state_config.column) == status
26
- end
27
-
28
- define_method("#{ status }!") do
29
- self.send("#{ self.class.affairs_of_state_config.column }=", status)
30
- self.save
31
- end
32
- end
33
-
34
- validates(affairs_of_state_config.column, inclusion: { in: affairs_of_state_config.statuses, allow_blank: affairs_of_state_config.allow_blank }, if: affairs_of_state_config.if)
35
-
36
- if affairs_of_state_config.scopes
37
- affairs_of_state_config.statuses.each do |status|
38
- self.scope(status.to_sym, -> { where(affairs_of_state_config.column => status) })
39
- end
40
- end
41
-
42
- include InstanceMethods
43
- extend SingletonMethods
44
-
45
- true
46
- end
47
-
48
- def affairs_of_state_config
49
- @affairs_of_state_config ||= AffairsOfState::Config.new
50
- end
51
- end
52
-
53
- module InstanceMethods
54
- end
55
-
56
- module SingletonMethods
57
- def statuses_for_select
58
- affairs_of_state_config.statuses.map{ |s| [s.humanize, s] }
59
- end
60
- end
61
- end
8
+ require "affairs_of_state/active_record_extension"
62
9
 
63
10
  ActiveSupport.on_load(:active_record) do
64
- ::ActiveRecord::Base.send :include, AffairsOfState
11
+ ::ActiveRecord::Base.send :include, AffairsOfState::ActiveRecordExtension
65
12
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe AffairsOfState do
@@ -6,57 +7,63 @@ describe AffairsOfState do
6
7
  affairs_of_state :active, :inactive, :cancelled
7
8
  end
8
9
 
9
- it "should set the constant" do
10
- expect(Pie::STATUSES).to eq(["active", "inactive", "cancelled"])
11
- end
10
+ subject { Pie }
12
11
 
13
12
  it "should validate the column is set" do
14
- expect(Pie.new(status: nil)).to_not be_valid
13
+ expect(subject.new(status: nil)).to_not be_valid
15
14
  end
16
15
 
17
16
  it "should validate that we're not setting it to something stupid" do
18
- expect(Pie.new(status: "delicious_pie")).to_not be_valid
17
+ expect(subject.new(status: "delicious_pie")).to_not be_valid
19
18
  end
20
19
 
21
20
  describe "boolean methods" do
22
21
  it "should find the set status" do
23
- p = Pie.new status: "active"
22
+ p = subject.new status: "active"
24
23
  expect(p.active?).to be_truthy
25
24
  end
26
25
 
27
26
  it "should not find if a different status is set" do
28
- p = Pie.new status: "inactive"
27
+ p = subject.new status: "inactive"
29
28
  expect(p.cancelled?).to be_falsy
30
29
  end
31
30
  end
32
31
 
33
32
  describe "update methods" do
34
33
  it "should set the value" do
35
- p = Pie.create! status: "active"
34
+ p = subject.create! status: "active"
36
35
  expect(p.inactive!).to be_truthy
37
36
  expect(p.status).to eq("inactive")
38
37
  end
39
38
  end
40
39
 
40
+ it "should have the statuses method with the nil default" do
41
+ expect(subject.statuses).to eq(["active", "inactive", "cancelled"])
42
+ end
43
+
44
+ it "should have the statuses method" do
45
+ expect(subject.statuses(:status)).to eq(["active", "inactive", "cancelled"])
46
+ end
47
+
41
48
  it "should provide a method to pass to dropdowns" do
42
- expect(Pie.statuses_for_select).to eq([["Active", "active"], ["Inactive", "inactive"], ["Cancelled", "cancelled"]])
49
+ expect(subject.statuses_for_select).to eq([["Active", "active"], ["Inactive", "inactive"], ["Cancelled", "cancelled"]])
43
50
  end
44
51
 
45
52
  describe "scopes" do
46
53
  it "should have a finder to match the status name" do
47
- Pie.create! status: "active"
48
- Pie.create! status: "inactive"
49
- Pie.create! status: "active"
50
- Pie.create! status: "cancelled"
51
-
52
- expect(Pie.active.size).to eq(2)
53
- expect(Pie.inactive.size).to eq(1)
54
- expect(Pie.cancelled.size).to eq(1)
54
+ subject.create! status: "active"
55
+ subject.create! status: "inactive"
56
+ subject.create! status: "active"
57
+ subject.create! status: "cancelled"
58
+
59
+ expect(subject.active.size).to eq(2)
60
+ expect(subject.inactive.size).to eq(1)
61
+ expect(subject.cancelled.size).to eq(1)
55
62
  end
56
63
  end
57
64
 
58
65
  after(:each) do
59
- Pie.destroy_all
66
+ subject.destroy_all
60
67
  end
61
68
  end
62
69
 
@@ -67,16 +74,18 @@ describe AffairsOfState do
67
74
  affairs_of_state :active, :inactive, column: :super_status
68
75
  end
69
76
 
77
+ subject { Pie2 }
78
+
70
79
  it "should validate the column is set" do
71
- expect(Pie2.new(status: nil, super_status: "active")).to be_valid
80
+ expect(subject.new(status: nil, super_status: "active")).to be_valid
72
81
  end
73
82
 
74
83
  it "should know the accessors" do
75
- expect(Pie2.new(status: nil, super_status: "inactive").inactive?).to be(true)
84
+ expect(subject.new(status: nil, super_status: "inactive").inactive?).to be(true)
76
85
  end
77
86
 
78
87
  it "should know the setters" do
79
- instance = Pie2.create!(status: nil, super_status: "inactive")
88
+ instance = subject.create!(status: nil, super_status: "inactive")
80
89
  expect(instance.active!).to be(true)
81
90
  expect(instance.super_status).to eq("active")
82
91
  end
@@ -89,8 +98,10 @@ describe AffairsOfState do
89
98
  affairs_of_state :active, :inactive, allow_blank: true
90
99
  end
91
100
 
101
+ subject { Pie3 }
102
+
92
103
  it "should validate the column is set" do
93
- expect(Pie3.new(status: nil)).to be_valid
104
+ expect(subject.new(status: nil)).to be_valid
94
105
  end
95
106
  end
96
107
 
@@ -101,8 +112,10 @@ describe AffairsOfState do
101
112
  affairs_of_state [:on, :off]
102
113
  end
103
114
 
115
+ subject { Pie4 }
116
+
104
117
  it "should work too if that's what floats your boat" do
105
- expect(Pie4::STATUSES).to eq(["on", "off"])
118
+ expect(subject.statuses).to eq(["on", "off"])
106
119
  end
107
120
  end
108
121
 
@@ -113,8 +126,10 @@ describe AffairsOfState do
113
126
  affairs_of_state :active, :inactive, scopes: false
114
127
  end
115
128
 
116
- it "should work too if that's what floats your boat" do
117
- expect(Pie5).to_not respond_to(:active)
129
+ subject { Pie5 }
130
+
131
+ it "should not respond if the scopes are not needed" do
132
+ expect(subject).to_not respond_to(:active)
118
133
  end
119
134
  end
120
135
 
@@ -127,15 +142,17 @@ describe AffairsOfState do
127
142
  attr_accessor :is_going_to_validate
128
143
  end
129
144
 
145
+ subject { Pie6 }
146
+
130
147
  it "should enforce the validation if the :if param is true" do
131
- p = Pie6.new
148
+ p = subject.new
132
149
  p.is_going_to_validate = true
133
150
  p.status = "pie"
134
151
  expect(p).to_not be_valid
135
152
  end
136
153
 
137
154
  it "should not enforce the validation if the :if param evaluates to false" do
138
- p = Pie6.new
155
+ p = subject.new
139
156
  p.is_going_to_validate = false
140
157
  p.status = "pie"
141
158
  expect(p).to be_valid
@@ -155,15 +172,17 @@ describe AffairsOfState do
155
172
  end
156
173
  end
157
174
 
175
+ subject { Pie7 }
176
+
158
177
  it "should enforce the validation if the :if param is true" do
159
- p = Pie7.new
178
+ p = subject.new
160
179
  p.is_going_to_validate = true
161
180
  p.status = "pie"
162
181
  expect(p).to_not be_valid
163
182
  end
164
183
 
165
184
  it "should not enforce the validation if the :if param evaluates to false" do
166
- p = Pie7.new
185
+ p = subject.new
167
186
  p.is_going_to_validate = false
168
187
  p.status = "pie"
169
188
  expect(p).to be_valid
@@ -177,13 +196,65 @@ describe AffairsOfState do
177
196
  end
178
197
 
179
198
  describe "multiple invocations" do
180
- it "raises an error" do
181
- expect(->{
182
- class Pie9 < ActiveRecord::Base
183
- affairs_of_state :not_important
184
- affairs_of_state :something
199
+ class Pie9 < ActiveRecord::Base
200
+ self.table_name = "pies"
201
+
202
+ affairs_of_state :active, :inactive
203
+ affairs_of_state :moderated, :unmoderated, column: :super_status
204
+ end
205
+
206
+ subject { Pie9 }
207
+
208
+ it "declares two status columns" do
209
+ p = subject.new
210
+ p.inactive!
211
+ p.unmoderated!
212
+ expect(p).to be_inactive
213
+ expect(p).to be_unmoderated
214
+ end
215
+
216
+ it "raises if called twice on the same column" do
217
+ expect {
218
+ class Pie < ActiveRecord::Base
219
+ self.table_name = "pies"
220
+
221
+ affairs_of_state :active, :inactive
222
+ affairs_of_state :moderated, :unmoderated
223
+ end
224
+ }.to raise_error(ArgumentError)
225
+ end
226
+
227
+ it "raises if called twice with the same status in both" do
228
+ expect {
229
+ class Pie < ActiveRecord::Base
230
+ self.table_name = "pies"
231
+
232
+ affairs_of_state :active, :inactive
233
+ affairs_of_state :dormant, :active, column: :super_status
185
234
  end
186
- }).to raise_error(ArgumentError, "Affairs of State: cannot be invoked multiple times on the same model")
235
+ }.to raise_error(ArgumentError)
236
+ end
237
+
238
+ it "raises if statuses is called with no argument" do
239
+ expect {
240
+ subject.statuses
241
+ }.to raise_error(ArgumentError)
242
+ end
243
+
244
+ it "returns the statuses for the column" do
245
+ expect(subject.statuses(:status)).to eq(["active", "inactive"])
246
+ expect(subject.statuses("super_status")).to eq(["moderated", "unmoderated"])
247
+ end
248
+
249
+ it "raises if statuses_for_select is called with no argument" do
250
+ expect {
251
+ subject.statuses_for_select
252
+ }.to raise_error(ArgumentError)
253
+ end
254
+
255
+ it "returns the statuses_for_select for the column" do
256
+ expect(subject.statuses_for_select(:status)).to eq([["Active", "active"], ["Inactive", "inactive"]])
257
+ expect(subject.statuses_for_select("super_status")).to eq([["Moderated", "moderated"], ["Unmoderated", "unmoderated"]])
187
258
  end
188
259
  end
189
260
  end
data/spec/config_spec.rb CHANGED
@@ -1,47 +1,51 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe AffairsOfState::Config do
4
- subject{ AffairsOfState::Config.new }
5
+ let(:config) do
6
+ AffairsOfState::Config.new(
7
+ statuses: statuses,
8
+ column: column,
9
+ allow_blank: allow_blank,
10
+ scopes: scopes,
11
+ if: if_condition
12
+ )
13
+ end
14
+ let(:column) { "state" }
15
+ let(:statuses) { [ :created, [ :destroyed ] ] }
16
+ let(:allow_blank) { "sure" }
17
+ let(:scopes) { nil }
18
+ let(:if_condition) { "false" }
5
19
 
6
- describe "accessors" do
7
- let(:expected){ double }
20
+ subject { config }
8
21
 
22
+ describe "accessors" do
9
23
  it "has :column" do
10
- subject.column = expected
11
- expect(subject.column).to eq(expected)
24
+ expect(subject.column).to eq(column)
12
25
  end
13
26
 
14
27
  it "has :allow_blank" do
15
- subject.allow_blank = expected
16
- expect(subject.allow_blank).to eq(expected)
28
+ expect(subject.allow_blank).to be(true)
17
29
  end
18
30
 
19
31
  it "has :scopes" do
20
- subject.scopes = expected
21
- expect(subject.scopes).to eq(expected)
32
+ expect(subject.scopes).to be(false)
22
33
  end
23
34
 
24
35
  it "has :if" do
25
- subject.if = expected
26
- expect(subject.if).to eq(expected)
36
+ expect(subject.if).to eq(if_condition)
27
37
  end
28
- end
29
38
 
30
- describe "#statuses=" do
31
- it "converts to string" do
32
- subject.statuses = [:a, :b]
33
- expect(subject.statuses).to eq(["a", "b"])
39
+ it "has :statuses and converts to strings and flattens" do
40
+ expect(subject.statuses).to eq(["created", "destroyed"])
34
41
  end
42
+ end
35
43
 
36
- it "flattens" do
37
- subject.statuses = ["a", [:b]]
38
- expect(subject.statuses).to eq(["a", "b"])
39
- end
44
+ context "with invalid status" do
45
+ let(:statuses) { [ "new" ] }
40
46
 
41
47
  it "makes sure no invalid statuses are allowed" do
42
- expect(->{
43
- subject.statuses = [:new]
44
- }).to raise_error(ArgumentError, "Affairs of State: 'new' is not a valid status")
48
+ expect { subject }.to raise_error(ArgumentError, "Affairs of State: 'new' is not a valid status")
45
49
  end
46
50
  end
47
51
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "affairs_of_state"
2
3
 
3
4
  require "pry"
@@ -5,9 +6,10 @@ require "sqlite3"
5
6
 
6
7
  RSpec.configure do |config|
7
8
  config.run_all_when_everything_filtered = true
9
+ config.filter_run_when_matching :focus
8
10
  end
9
11
 
10
- ## Create an AR model to test with
12
+ # Create an AR model to test with
11
13
  I18n.enforce_available_locales = false
12
14
 
13
15
  ActiveRecord::Base.establish_connection(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: affairs_of_state
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin McPhillips
@@ -14,44 +14,44 @@ dependencies:
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '6.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '6.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,30 +70,30 @@ dependencies:
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.12.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.12.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '12'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '12'
97
97
  description: Add a simple state to a gem, without all the hassle of a complex state
98
98
  machine.
99
99
  email:
@@ -114,6 +114,7 @@ files:
114
114
  - gemfiles/activerecord-6.1.gemfile
115
115
  - gemfiles/activerecord-latest.gemfile
116
116
  - lib/affairs_of_state.rb
117
+ - lib/affairs_of_state/active_record_extension.rb
117
118
  - lib/affairs_of_state/config.rb
118
119
  - lib/affairs_of_state/version.rb
119
120
  - spec/affairs_of_state_spec.rb