acts_as_living 0.1.14 → 0.1.19

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: 73d33885449af7caca352c2349ec8bb1897f01b6b3d6906b8dd414d4dda6d6c9
4
- data.tar.gz: e8fc368946103d716e0c84132f9f84662f21ddbf392237de7f2309801c8f0f9b
3
+ metadata.gz: 159567b51bd98c24c6fda7a46ebad69c69914d6ba292b5fc854c607723933ea8
4
+ data.tar.gz: dd7717e7d774dee7b9b2c536869186036f602bcae22c58677706486ab90e1d04
5
5
  SHA512:
6
- metadata.gz: 5fca0d7f19165ac60768f58cb92c29f516b7746a8078fcadfb13176d5b7899d3a5acfe8018f638a0ea31256e89cbc24075aee378f4df5f33a0e9c7365612d05e
7
- data.tar.gz: 07e876c5194830496f4bccbd9a6e849e59d102bc7607105152acbe01e197a6978f0194a2c1071f797a5b130bfb8e2ea5b6eda041d2ba2df863e50063382b3d73
6
+ metadata.gz: 137fd75859aae03b7598a8999b97bcde0f38329bf7c59e43802f50e6356a5b3dea39617522af2c9115731df054aa936dd2effa864a39d25d7f8a1adf92e4c337
7
+ data.tar.gz: 67a5d0b66bc15ac8ab19a81e8ca46bbb4001d4784eaf0fd3224ae56f01d341b813be624a5f6cfa1640f1821bf8839410ae6c0c9f1cfc074b663f663f2aecb107
@@ -20,7 +20,7 @@ module ActsAsLiving::ActsAsLiving
20
20
  ActsAsLiving::MethodsDefiner.call(self)
21
21
  ActsAsLiving::EnumDefiner.call(self)
22
22
  ActsAsLiving::ScopesDefiner.call(self)
23
- ActsAsLiving::ValidationsDefiner.call(self)
23
+ # ActsAsLiving::ValidationsDefiner.call(self)
24
24
  end
25
25
  end
26
26
  end
@@ -5,7 +5,7 @@ module ActsAsLiving::EnumDefiner
5
5
  klass.class_eval do
6
6
  extend ClassMethods
7
7
 
8
- enum @column => stages_enum
8
+ enum stage: stages_enum
9
9
  end
10
10
  end
11
11
 
@@ -140,15 +140,15 @@ module ActsAsLiving::MethodsDefiner
140
140
  end
141
141
 
142
142
  def last_stage?(stage)
143
- last_stage == stage
143
+ last_stage.to_s == stage.to_s
144
144
  end
145
145
 
146
- def first_stage_stage
146
+ def first_stage
147
147
  (stage_keys - %i[cancelled]).first
148
148
  end
149
149
 
150
150
  def first_stage?(stage)
151
- first_stage_stage == stage
151
+ first_stage.to_s == stage.to_s
152
152
  end
153
153
 
154
154
  def death
@@ -194,11 +194,11 @@ module ActsAsLiving::MethodsDefiner
194
194
 
195
195
  def define_stage_queries(stage_key)
196
196
  define_method("stage_changed_to_#{stage_key}?") do
197
- stage_changed? && stage_was == stage_key
197
+ stage_changed? && stage_was.to_s == stage_key.to_s
198
198
  end
199
199
 
200
200
  define_method("stage_saved_to_#{stage_key}?") do
201
- saved_change_to_stage? && stage == stage_key
201
+ saved_change_to_stage? && stage.to_s == stage_key.to_s
202
202
  end
203
203
 
204
204
  define_method("pre_#{stage_key}?") do
@@ -210,7 +210,7 @@ module ActsAsLiving::MethodsDefiner
210
210
  end
211
211
 
212
212
  define_method("cancelled_from_#{stage_key}?") do
213
- stage == 'cancelled' && stage_was == stage_key
213
+ stage == 'cancelled' && stage_was.to_s == stage_key.to_s
214
214
  end
215
215
  end
216
216
  end
@@ -1,32 +1,26 @@
1
1
  module ActsAsLiving::ValidationsDefiner
2
- def self.call(klass)
3
- klass.class_eval do
4
- include InstanceMethods
2
+ # def self.call(klass)
3
+ # klass.class_eval do
4
+ # include InstanceMethods
5
5
 
6
- validates :stage, presence: true
6
+ # validates :stage, presence: true
7
7
 
8
- validate :stage_progression, on: :update, if: :stage_changed?
9
- validate :initialized_stage, on: :create, if: :stage_changed?
10
- end
11
- end
8
+ # validate :stage_progression, on: :update, if: :stage_changed?
9
+ # validate :stage_is_first_stage, on: :create, if: :stage_changed?
10
+ # end
11
+ # end
12
12
 
13
- module InstanceMethods
14
- def stage_progression
15
- return if stage.to_s == self.class.death.to_s || stage == stage_after(stage_was)
13
+ # module InstanceMethods
14
+ # def stage_progression
15
+ # return if stage.to_s == self.class.death.to_s || stage == stage_after(stage_was)
16
16
 
17
- message = if stage_was == self.class.final_stage
18
- "The contract can only be updated to '#{self.class.death}'"
19
- else
20
- "The contract can only be updated to '#{self.class.death}' or '#{stage_after(stage_was)}'"
21
- end
17
+ # message = if stage_was == self.class.final_stage
18
+ # "The contract can only be updated to '#{self.class.death}'"
19
+ # else
20
+ # "The contract can only be updated to '#{self.class.death}' or '#{stage_after(stage_was)}'"
21
+ # end
22
22
 
23
- errors.add(:stage, message)
24
- end
25
-
26
- def initialized_stage
27
- return if stage == self.class.initial_stage
28
-
29
- errors.add(:stage, "Contract has to be initialized with '#{self.class.initial_stage}' stage")
30
- end
31
- end
23
+ # errors.add(:stage, message)
24
+ # end
25
+ # end
32
26
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsLiving
2
- VERSION = "0.1.14"
2
+ VERSION = "0.1.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_living
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Andrade