effective_resources 1.3.15 → 1.3.16

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
  SHA256:
3
- metadata.gz: c9401a04b558eb6438c84b7a4fefe259d37fc3deecf022aa95729a18fdc24511
4
- data.tar.gz: 137da931f63327136a49d05ad14de51cd1b70f7d0878dc530978f9778d79da7e
3
+ metadata.gz: d7e03695900381e818f1b43f1cffa5880c3c8cc51e95a4ca7d7f5a634b1d3439
4
+ data.tar.gz: 298f386f1def244429b50643da2b12c8981b8c792714205f17c656c31b1cf9ec
5
5
  SHA512:
6
- metadata.gz: 4da7d55ebb3f63dff8f64a549cd6fc90331dcbf7e41b37c19dcf780390efd10e62f15db71175514e30344d60d448d3b9943bcfb165769ecfc4eb7d98c1976c08
7
- data.tar.gz: 1301f38268a74ae5a159c0a63fa8af7f5b4ace3a157d10a45ebcf46abcec25eb0709519354a28394e2355b0507ba47c5ef5ffc7c22ce4062c70044a55151c040
6
+ metadata.gz: d684ebb7078363cf3dbfd06dcb0e49fa75c47f72d979809d0783f71a0d922d0f5e765ad3451703d5aff6f1559c3ea39affe5c44abcda3e3a37173d4ca57b4ed4
7
+ data.tar.gz: 68bb600221adc7747afd558d67f5a75c401163ab08ac606df7f31e73a61f8a5101c6b3d82becb059dc007fc0d25bdb65b2a23768faee138eb2f2a5712b3ce1f7
@@ -120,52 +120,34 @@ module ActsAsStatused
120
120
 
121
121
  # Create an received scope and approved? method for each status
122
122
  acts_as_statused_options[:statuses].each do |sym|
123
- unless respond_to?("#{sym}?")
124
- define_method("#{sym}?") { status == sym.to_s }
125
- end
123
+ define_method("#{sym}?") { status == sym.to_s }
124
+ define_method("was_#{sym}?") { send("#{sym}_at").present? }
126
125
 
127
- unless respond_to?("#{sym}_at")
126
+ unless has_attribute?("#{sym}_at")
128
127
  define_method("#{sym}_at") { status_steps["#{sym}_at".to_sym] }
129
- end
130
-
131
- unless respond_to?("#{sym}_at=")
132
128
  define_method("#{sym}_at=") { |value| status_steps["#{sym}_at".to_sym] = value }
133
129
  end
134
130
 
135
- unless respond_to?("#{sym}_by")
131
+ unless has_attribute?("#{sym}_by_id")
136
132
  define_method("#{sym}_by") { acts_as_statused_by_user(sym) }
137
- end
138
-
139
- unless respond_to?("#{sym}_by_id")
140
133
  define_method("#{sym}_by_id") { status_steps["#{sym}_by".to_sym] }
141
- end
142
-
143
- unless respond_to?("#{sym}_by_id=")
144
134
  define_method("#{sym}_by_id=") { |value| status_steps["#{sym}_by".to_sym] = value }
145
135
  end
146
136
 
147
- unless respond_to?("was_#{sym}?")
148
- define_method("was_#{sym}?") { send("#{sym}_at").present? }
149
- end
150
-
151
137
  # approved!
152
- unless respond_to?("#{sym}!")
153
- define_method("#{sym}!") do |atts = {}|
154
- raise 'expected a Hash of passed attributes' unless atts.kind_of?(Hash)
155
- update!(atts.merge(status: sym))
156
- end
138
+ define_method("#{sym}!") do |atts = {}|
139
+ raise 'expected a Hash of passed attributes' unless atts.kind_of?(Hash)
140
+ update!(atts.merge(status: sym))
157
141
  end
158
142
 
159
143
  # unapproved!
160
- unless respond_to?("un#{sym}!")
161
- define_method("un#{sym}!") do
162
- self.status = nil if (status == sym.to_s)
144
+ define_method("un#{sym}!") do
145
+ self.status = nil if (status == sym.to_s)
163
146
 
164
- status_steps.delete("#{sym}_at".to_sym)
165
- status_steps.delete("#{sym}_by".to_sym)
147
+ status_steps.delete("#{sym}_at".to_sym)
148
+ status_steps.delete("#{sym}_by".to_sym)
166
149
 
167
- true
168
- end
150
+ true
169
151
  end
170
152
 
171
153
  scope(sym, -> { where(status: sym.to_s) })
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.3.15'.freeze
2
+ VERSION = '1.3.16'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.15
4
+ version: 1.3.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-13 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails