enum_ext 0.4.3 → 0.4.4

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: 74e124aa3c4dcc444a79313a06d79aa55862a58c065a00b399797413e11ca13a
4
- data.tar.gz: ba28311cd931ba1233585407f8532c5026a7dee51b3a695c3c36a8fd675ec27e
3
+ metadata.gz: 31b1c2e892139a6c351a6eceac3680a3f564175e74a590030923866e2ea1e23c
4
+ data.tar.gz: 43edecda5dbc4f647ab1e405647ae31dbf7c671d9fd16a17a65c6d922bee4dc4
5
5
  SHA512:
6
- metadata.gz: 103d98798be494d1fc9b8354dc84b4bad405d282c3aa83be42cee4800775bc20b848294d913cf682be5e7e25db03bb34fb402bd296e9376d461e1cd29a369b3f
7
- data.tar.gz: '081f7581316c5904826f0daf2aa023a8a959900c0cbe4ea3d16a64831602d17ff5b267260d8ff97da62e4c83676a07ae28996b767fd7dd120c73dce7484d09f5'
6
+ metadata.gz: 86ee6244b2b81a2d70edae5c5675322feac5c9a7e69b7f141c0ce11f9f4a8eacc10f6ae16b6e5e4ed87f4852dd9a59b9120291e7c86456880908e9afbe4b8f32
7
+ data.tar.gz: 8b2468b334499d88c470b20d397b531ecb39344101c8366faa031ad1e58a70f0cebef70f4479aa67c8c7bd1670cfb8d9dbbf86eb9cdaee6270ea5f0a9f0ad14f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.4.4
2
+ * ext_enum_sets now can be executed without 'scope' definition present on the base class,
3
+ for instance you can now use with StoreModel's
4
+
1
5
  # 0.4.3
2
6
  * ext_enum_sets now can go without options just to define with and without scopes
3
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enum_ext (0.4.1)
4
+ enum_ext (0.4.4)
5
5
  activerecord (>= 5.2.4.3)
6
6
 
7
7
  GEM
data/lib/enum_ext.rb CHANGED
@@ -77,18 +77,18 @@ module EnumExt
77
77
  scope "with_#{enum_plural}", -> (sets_arr) {
78
78
  where( enum_name => self.send( enum_plural ).slice(
79
79
  *sets_arr.map{|set_name| self.try( "#{set_name}_#{enum_plural}" ) || set_name }.flatten.uniq.map(&:to_s) ).values )
80
- } unless respond_to?("with_#{enum_plural}")
80
+ } if !respond_to?("with_#{enum_plural}") && respond_to?(:scope)
81
81
 
82
82
  # without_enums scope
83
83
  scope "without_#{enum_plural}", -> (sets_arr) {
84
84
  where.not( id: self.send("with_#{enum_plural}", sets_arr) )
85
- } unless respond_to?("without_#{enum_plural}")
85
+ } if !respond_to?("without_#{enum_plural}") && respond_to?(:scope)
86
86
 
87
87
  options.each do |set_name, enum_vals|
88
88
  # set_name scope
89
- scope set_name, -> { where( enum_name => self.send( enum_plural ).slice( *enum_vals.map(&:to_s) ).values ) }
89
+ scope set_name, -> { where( enum_name => self.send( enum_plural ).slice( *enum_vals.map(&:to_s) ).values ) } if respond_to?(:scope)
90
90
 
91
- # class.enum_set_values
91
+ # class.enum_set_values
92
92
  define_singleton_method( "#{set_name}_#{enum_plural}" ) do
93
93
  enum_vals
94
94
  end
@@ -1,3 +1,3 @@
1
1
  module EnumExt
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - alekseyl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord