def_enum_helper 0.6.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: f99a30403997eaeda0c3e164bb9d8692abe6e68b
4
- data.tar.gz: 1d0e7b08c52269b6659bb5011f0131ad4ba2cda0
3
+ metadata.gz: 6716d54dc234d894fe3c944da6eed2f95a333dcf
4
+ data.tar.gz: 97e542fc0a6594f65720686fd52f7a2ed9edc4c6
5
5
  SHA512:
6
- metadata.gz: 5ba0af7fb328ca8491af01f85ddc4a967b5d3b4834cb2f2d9c18896c00fc316785d3242bc383576686ab8f10180f87b1afb465c5830733801fce9b49d1e9c035
7
- data.tar.gz: 12309cb56c5d64971d8f339d478cd3f32b4a04314df9e3f6c8df1f25f884f243d642fa02371819b4a8d25e3015b55e112583eaf69289a6b46ec32402d61e9e99
6
+ metadata.gz: bb0afcc78f37940a3c925177533b80b57f28499092bd0e3c2e2d75c13694f1454f2aab7be55bde68c002d6dabc80f60dab831b44eb071603567ecb0f624dc62f
7
+ data.tar.gz: da0bdcf1505507f3c5b62e3ad728c6308a647897ad4cc364baafe86034ee1087b27abfd7d37034b6fb059ab6e14b0fa5ec90d68f1af14a3781281dc63465057c
data/README.md CHANGED
@@ -35,6 +35,7 @@ YinYang["阳"] # same as YinYang[1]
35
35
  YinYang.all # 所有枚举的struct array [#<struct index=1, display="阳">, # <struct index=2, display="阴">]
36
36
  puts YinYang.count # 2
37
37
  YinYang.each{|x| puts x} # <struct index=1, display="阳"> #<struct index=2, display="阴">
38
+ YinYang.map{|x| x} # [#<struct index=1, display="阳">, #<struct index=2, display="阴">]
38
39
  puts YinYang.to_hash_array # [{:index=>1, :display=>"阳"}, {:index=>2, :display=>"阴"}]
39
40
  puts YingYang.to_json_array # [{"index":1,"display":"阳"},{"index":2,"display":"阴"}]
40
41
  ```
@@ -1,3 +1,3 @@
1
1
  module DefEnumHelper
2
- VERSION = "0.6.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -16,6 +16,7 @@ require "def_enum_helper/version"
16
16
  # YinYang.all # 所有枚举的struct array [#<struct index=1, display="阳">, # <struct index=2, display="阴">]
17
17
  # puts YinYang.count # 2
18
18
  # YinYang.each{|x| puts x} # <struct index=1, display="阳"> #<struct index=2, display="阴">
19
+ # YinYang.map{|x| x} # [#<struct index=1, display="阳">, #<struct index=2, display="阴">]
19
20
  # puts YinYang.to_hash_array # [{:index=>1, :display=>"阳"}, {:index=>2, :display=>"阴"}]
20
21
  # puts YingYang.to_json_array # [{"index":1,"display":"阳"},{"index":2,"display":"阴"}]
21
22
 
@@ -78,6 +79,7 @@ def define_iterator_methods(m, enum_index_hash)
78
79
  m.define_singleton_method(:map) { |&blk| enum_index_hash.values.map { |v| blk.call(v) } }
79
80
 
80
81
  m.define_singleton_method(:all) { enum_index_hash.values }
82
+ m.define_singleton_method(:keys) { enum_index_hash.keys }
81
83
  end
82
84
 
83
85
  def define_subscript_method(m, enum_index_hash, enum_display_hash)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: def_enum_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Zhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-17 00:00:00.000000000 Z
11
+ date: 2017-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.6.6
76
+ rubygems_version: 2.6.13
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: define very powerful enum class