simple_enum 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/simple_enum/attribute.rb +3 -3
- data/lib/simple_enum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead9e5d2a63ed29727c934fa36cf37a544dacd65
|
4
|
+
data.tar.gz: 89da3f9fa8ee6e7ef19f028bed68167d8e592f55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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.
|
59
|
+
scope_option, feature_options = with_options.partition { |option| option == :scope }
|
60
60
|
|
61
|
-
|
61
|
+
feature_options.each do |feature|
|
62
62
|
send "generate_enum_#{feature}_methods_for", enum, accessor
|
63
63
|
end
|
64
64
|
|
65
|
-
|
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
|
data/lib/simple_enum/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|