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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1886e30cb7c12fb80faac2bb6268651d19770843f332ad8daa8c0283d4654ecb
4
- data.tar.gz: 344f2f3cb2dd39378f757440e812eb192d818352776a044e3e684835d54ef1a0
3
+ metadata.gz: 3e87290cedea511a2ba4b8cab31230571fdb44a028f467b7977a23fd5bed077b
4
+ data.tar.gz: 39ca800b0d746cdcf75a5351841e93df6dc9e1172ac920366921584422d05e62
5
5
  SHA512:
6
- metadata.gz: ce3a6411127363f0635cc966dca7b04de9d5e504189c3bc1aa2a9d774ae7e12c66b2a771493c3260568b2673916af48633271f5fce44af3e53e74d3b2ba36381
7
- data.tar.gz: cb8b39466ae50ddc3735101587c540e03d7369b89d7d36026dbf5f3888df78c7e655bc3f4c7abf9fa9f762041a595dd7930de72ae17f8be5414652972445eabe
6
+ metadata.gz: f25c46c79d4a0f7072061260a60676c6a513fd0661052425eb56569bac1d422975c725e91691b11ea3854ec4b3345ebd0d25f7758ece6737b844c809ea7a6741
7
+ data.tar.gz: 98980a7c434376bb0b28868dac1d77731030347024a9d46844554d217b7fa5e89d5f49e5c6078bd6025d4aa2dbfe0107689dd9f9c3f15ee734de95da73aa9476
@@ -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
@@ -16,6 +16,7 @@ module ActsAsLiving::ActsAsLiving
16
16
  end
17
17
 
18
18
  def run_definers
19
+ # needs to be imported first
19
20
  ActsAsLiving::MethodsDefiner.call(self)
20
21
  ActsAsLiving::EnumDefiner.call(self)
21
22
  ActsAsLiving::ScopesDefiner.call(self)
@@ -5,12 +5,12 @@ module ActsAsLiving::EnumDefiner
5
5
  klass.class_eval do
6
6
  extend ClassMethods
7
7
 
8
- enum @column => enum_options
8
+ enum @column => stages_enum
9
9
  end
10
10
  end
11
11
 
12
12
  module ClassMethods
13
- def enum_options
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, _num|
5
- scope "past_#{stage}", -> { where('stage >= ?', stages[stage]) }
6
- scope "pre_#{stage}", -> { where('stage < ?', stages[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
- @phases.each do |phase, delimiters|
13
- if delimiters.length == 1
14
- scope phase, -> { where(stage: delimiters.first) }
15
- else
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
@@ -1,3 +1,3 @@
1
1
  module ActsAsLiving
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.11"
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.6
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Andrade