acts_as_living 0.1.6 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -0
- data/lib/acts_as_living/acts_as_living.rb +1 -0
- data/lib/acts_as_living/enum_definer.rb +2 -2
- data/lib/acts_as_living/scopes_definer.rb +7 -12
- data/lib/acts_as_living/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e87290cedea511a2ba4b8cab31230571fdb44a028f467b7977a23fd5bed077b
|
4
|
+
data.tar.gz: 39ca800b0d746cdcf75a5351841e93df6dc9e1172ac920366921584422d05e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25c46c79d4a0f7072061260a60676c6a513fd0661052425eb56569bac1d422975c725e91691b11ea3854ec4b3345ebd0d25f7758ece6737b844c809ea7a6741
|
7
|
+
data.tar.gz: 98980a7c434376bb0b28868dac1d77731030347024a9d46844554d217b7fa5e89d5f49e5c6078bd6025d4aa2dbfe0107689dd9f9c3f15ee734de95da73aa9476
|
data/Changelog.md
CHANGED
@@ -9,3 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
## [0.1.3] - 2020-07-12
|
10
10
|
### Added
|
11
11
|
- Fixed namespacing of the api endpoint
|
12
|
+
|
13
|
+
## [0.1.7] - 2020-07-13
|
14
|
+
### Fixed
|
15
|
+
- Stage Scopes
|
16
|
+
|
17
|
+
|
18
|
+
## [0.1.10] - 2020-07-13
|
19
|
+
### Fixed
|
20
|
+
- Bugs in phase scopes
|
@@ -5,12 +5,12 @@ module ActsAsLiving::EnumDefiner
|
|
5
5
|
klass.class_eval do
|
6
6
|
extend ClassMethods
|
7
7
|
|
8
|
-
enum @column =>
|
8
|
+
enum @column => stages_enum
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
module ClassMethods
|
13
|
-
def
|
13
|
+
def stages_enum
|
14
14
|
stages = @stage_keys.map.with_index(&method(:to_enum_map)).to_h
|
15
15
|
stages.merge(@death => @spread * -1)
|
16
16
|
end
|
@@ -1,22 +1,17 @@
|
|
1
1
|
module ActsAsLiving::ScopesDefiner
|
2
2
|
def self.call(klass)
|
3
3
|
klass.class_eval do
|
4
|
-
stages.each do |stage
|
5
|
-
scope "past_#{stage}", -> { where('stage >= ?',
|
6
|
-
scope "pre_#{stage}", -> { where('stage < ?',
|
7
|
-
scope "not_#{stage}", -> { where.not(stage: stage) }
|
4
|
+
stages.each do |stage,|
|
5
|
+
scope "past_#{stage}", -> { where('stage >= ?', stages_enum[stage]) }
|
6
|
+
scope "pre_#{stage}", -> { where('stage < ?', stages_enum[stage]) }
|
8
7
|
end
|
9
8
|
|
10
9
|
scope :cancelled, -> { where('stage < 0') }
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
scope phase, lambda {
|
17
|
-
where('stage >= ? AND stage <= ?', stages[delimiters.first], stages[delimiters.second])
|
18
|
-
}
|
19
|
-
end
|
11
|
+
phases.each do |phase, delimiters|
|
12
|
+
scope phase, lambda {
|
13
|
+
where(stage: delimiters)
|
14
|
+
}
|
20
15
|
end
|
21
16
|
end
|
22
17
|
end
|