simple_enum 2.3.1 → 2.3.2

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
  SHA1:
3
- metadata.gz: bc6b8efefb2a56dd5cca3e9f9751a2dc63dbf026
4
- data.tar.gz: 973c2ac8568b97a5c384ef150cbd4721a42a606b
3
+ metadata.gz: ead9e5d2a63ed29727c934fa36cf37a544dacd65
4
+ data.tar.gz: 89da3f9fa8ee6e7ef19f028bed68167d8e592f55
5
5
  SHA512:
6
- metadata.gz: 5f618673f56b4777f5c7320eb16276a54ecfcca341925ce21bca89d89f162ba331110b6f4df2669f6407ea448c8af7ab66baa80e6afc64cfdfa24d81009fc5dc
7
- data.tar.gz: d5cbba0c10de4983a916282b803e11b6acdf6146fce6f2aa5e7f7f28640eda2cb3a48e18e5f8c0c248c88c5c2213ddc8a792497ee9a56f7d70f295796a407414
6
+ metadata.gz: 834dd3a7c5e92d44c0317ac88356af38a56fdc0581dd4b4101583dbb494f0fa1d027e88f2bd1d9d134783bab08171ff998d604d78db5ce3588cec24c301f4b1e
7
+ data.tar.gz: a4947957c71ddeb731981403288daea009f8e6b565657cf04a140de9201cf507e2f0c81490981b2d481f903035ac608572c89e3b62b8b4499d671775f4ffa6a9
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  SimpleEnum
2
2
  ==========
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/simple_enum.svg)](https://badge.fury.io/rb/simple_enum)
4
5
  [![Build Status](https://travis-ci.org/lwe/simple_enum.svg)](https://travis-ci.org/lwe/simple_enum)
5
6
  [![Code Climate](https://codeclimate.com/github/lwe/simple_enum.svg)](https://codeclimate.com/github/lwe/simple_enum)
6
7
 
@@ -106,7 +107,7 @@ By default, scope names are generated as pluralized forms of the defined enum va
106
107
 
107
108
  ```ruby
108
109
  class Booking < ActiveRecord::Base
109
- as_enum :status, active: 1, cancelled: 2, pending: 3
110
+ as_enum :status, %i{active cancelled pending}
110
111
  end
111
112
  ```
112
113
 
@@ -121,7 +122,7 @@ By setting `pluralize_scopes: false` will not generate pluralized versions of sc
121
122
 
122
123
  ```ruby
123
124
  class Booking < ActiveRecord::Base
124
- as_enum :status, active: 1, cancelled: 2, pending: 3, pluralize_scopes: false
125
+ as_enum :status, %i{active cancelled pending}, pluralize_scopes: false
125
126
  end
126
127
  ```
127
128
 
@@ -56,13 +56,13 @@ module SimpleEnum
56
56
 
57
57
  def generate_additional_enum_methods_for(enum, accessor, options)
58
58
  with_options = Array.wrap(options.fetch(:with, SimpleEnum.with))
59
- scope_option = with_options.delete(:scope)
59
+ scope_option, feature_options = with_options.partition { |option| option == :scope }
60
60
 
61
- with_options.each do |feature|
61
+ feature_options.each do |feature|
62
62
  send "generate_enum_#{feature}_methods_for", enum, accessor
63
63
  end
64
64
 
65
- if scope_option
65
+ unless scope_option.empty?
66
66
  pluralize_scopes = options.fetch(:pluralize_scopes, SimpleEnum.pluralize_scopes)
67
67
  generate_enum_scope_methods_for(enum, accessor, pluralize_scopes)
68
68
  end
@@ -1,5 +1,5 @@
1
1
  module SimpleEnum
2
2
 
3
3
  # The current `SimpleEnum` version.
4
- VERSION = "2.3.1"
4
+ VERSION = "2.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Westermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-11 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport