galetahub-enum_field 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +5 -2
- data/lib/enum_field/builder.rb +1 -1
- data/lib/enum_field/define_enum.rb +1 -1
- data/lib/enum_field/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bca2cd26a65aed9da78b857dfa411cb9fadb58f4a81b9d1210e647415b54888e
|
4
|
+
data.tar.gz: cb795d43547eaed7c63f8a876aa72ebcfa3630cbb13c42fc60357853f853f762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8440864257d9c15d30b7098eaaf731ddac95c820c3e98e6fc3a9d4aedcd24e6267ff169b399e6c7d5f8a927713afea380b3b084e1a5aa381bfaed0153bca28a4
|
7
|
+
data.tar.gz: dd780b0a27aff83db43819b5f5f9922277428c07eab20824eebdec295d84d79500a284deb30abbf43965b701596fcb14f075302771cc7e54e1ab19943fbe3ade
|
data/README.md
CHANGED
@@ -61,11 +61,14 @@ user.role = Role.manager
|
|
61
61
|
user.role_id == Role.manager.id # will be true
|
62
62
|
|
63
63
|
Role.manager.name # :manager
|
64
|
-
user.role.name
|
64
|
+
user.role.name # :manager
|
65
|
+
|
66
|
+
Role.names # [:admin, :manager, :employee]
|
67
|
+
Role.ids # [1, 2, 3]
|
65
68
|
|
66
69
|
User.first.role.id == User.first.role_id # will be true
|
67
70
|
|
68
|
-
Role[:manager]
|
71
|
+
Role[:manager] == Role.manager # will be true
|
69
72
|
Role['manager'] == Role.manager # will be true
|
70
73
|
|
71
74
|
instance = Role[:employee]
|
data/lib/enum_field/builder.rb
CHANGED
@@ -17,7 +17,7 @@ module EnumField
|
|
17
17
|
module ClassMethods
|
18
18
|
def define_enum(options = {}, &block)
|
19
19
|
@enum_builder ||= EnumField::Builder.new(self, options)
|
20
|
-
@enum_builder.instance_exec(&block)
|
20
|
+
@enum_builder.instance_exec(&block) unless @enum_builder.frozen?
|
21
21
|
|
22
22
|
EnumField::Builder::METHODS.each do |method|
|
23
23
|
define_singleton_method method do |*args, &method_block|
|
data/lib/enum_field/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: galetahub-enum_field
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Galeta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-07-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.6
|
109
|
+
rubygems_version: 2.7.6
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Enumerated attributes for any ruby class aka Active Record
|