enum_ish 1.2.2 → 1.2.3

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: 17969b00055223b32c415d1dffeb22855a8efa1de17aa46fbf0cf51114f65de5
4
- data.tar.gz: 9fcc271cbd49bc7ad4e670b88a3c8120f21a8e6b38d8192b1705d7fd94811f85
3
+ metadata.gz: 58df4091edebc5965ce060bd1342f7088f4749aaa18977c76655b44fa823245d
4
+ data.tar.gz: 3e97c949be6dc3a88bc03aa20fd5317e681cc68681857581bc9d24abc0fcb38c
5
5
  SHA512:
6
- metadata.gz: b3449674e452b6d28fb71ce522fff9ffcece57d56c396e09911a2d21aa23071ea633df22b02fd1691e5c51d269c19ebdebbfadeee48ef08e106153fbc755194c
7
- data.tar.gz: ffe384c257c5f77bd684b17fcdba46f4e1b4cc3486d1d1dc6ef3304f8b8c0a950c42f68be4255cc62e495279279804ef6fb74ebbbdcfe64627e491430525bc2c
6
+ metadata.gz: 2a08c825b4b4e77c904f77cf5088026d34dd66439c9553a47cce1abecc4dd7d52cc9514c3b48f9fab81d7bef4263bd0eb5e3cea34afdbbc446513e672a5f0276
7
+ data.tar.gz: 62bd16fd0c155a7ca5144be68fb12d3b413996ce1a316caf70ede933842ce757d315054f47641d6a9de5b2dd1b1cc4744745c735a845c9cece3550d465e53622
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.2.3
4
+
5
+ * Keep enum definitions as a hash internally.
6
+
3
7
  ## 1.2.2
4
8
 
5
9
  * Support assignment of string in addition to symbol.
data/lib/enum_ish.rb CHANGED
@@ -11,9 +11,8 @@ module EnumIsh
11
11
  def enum_ish(name, map, config = {})
12
12
  enum = Enum.new(name, map, config)
13
13
 
14
- self.class_attribute :_enum_ish_enums unless self.respond_to?(:_enum_ish_enums)
15
- self._enum_ish_enums ||= []
16
- self._enum_ish_enums << enum
14
+ self._enum_ish_enums ||= {}
15
+ self._enum_ish_enums[name.to_sym] = enum
17
16
 
18
17
  if defined?(ActiveRecord::Base) && self.ancestors.include?(ActiveRecord::Base)
19
18
  ActiveRecordDefiner.new(self).define(enum)
@@ -21,4 +20,8 @@ module EnumIsh
21
20
  Definer.new(self).define(enum)
22
21
  end
23
22
  end
23
+
24
+ def self.extended(klass)
25
+ klass.class_attribute :_enum_ish_enums
26
+ end
24
27
  end
@@ -1,3 +1,3 @@
1
1
  module EnumIsh
2
- VERSION = '1.2.2'
2
+ VERSION = '1.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_ish
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-13 00:00:00.000000000 Z
11
+ date: 2019-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport