ya_enum 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: a106c33ed233da57efc28bd52705e0f51b21e6e0128b2894c2f737bc35e0a5bb
4
- data.tar.gz: 88cae23578783b66a5f24ebb69c9ad78db2509fbf155cf70c265e2f656a7ac04
3
+ metadata.gz: 70570e522d55f0fc7c4709f5c43ed635843815d960965152348c060d153ba97d
4
+ data.tar.gz: 13259fd63a930663cf41ee6a5c86560f5d4d1ea58ede056de659dc3d0c285b06
5
5
  SHA512:
6
- metadata.gz: 0d268806df3b76a4695e496636ab78031977f3b37da5ae5994922859d8f8e382e3f06e0c20609e93acd91ad49633564c11479ab9e72b12f4c1aa5388e31a1c6f
7
- data.tar.gz: 47a9e190ff9e6fabcf2dce506caa7ab71213ec07b5a1b8672b19e0929a25e163844ac7b78daa17d873ff86bf5e37d81daf7172ba59ec01e57272f279c9fa7621
6
+ metadata.gz: 431ed7a9c20d237afdb214c5e68503a0b38194b34832caeaf60fdfe80d89dee660ebde4e50d06f2b5e9bedabdfcd9a92390a2d608d159f0f0eca595f3b8ff298
7
+ data.tar.gz: 201622cd89ef2fbc36cd4a6f1b8f5d8e5b0f277ba1a37e9c575794a4a232d5fcbdaf0b03c65edc4e9d6cc1401e3dde4245027d6ec37194d37117372f50f42e18
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ya_enum (0.1.1)
4
+ ya_enum (0.1.3)
5
5
  takes_macro (>= 1.0.0)
6
6
 
7
7
  GEM
@@ -21,4 +21,4 @@ DEPENDENCIES
21
21
  ya_enum!
22
22
 
23
23
  BUNDLED WITH
24
- 1.16.1
24
+ 1.17.1
data/README.md CHANGED
@@ -170,8 +170,8 @@ end
170
170
 
171
171
  color = Colors::Red
172
172
 
173
- Colors.case(color) do
174
- on(Colors::Red) do
173
+ Colors.case(color) do |c|
174
+ c.on(Colors::Red) do
175
175
  puts "red!"
176
176
  end
177
177
  end
@@ -36,7 +36,11 @@ module YaEnum
36
36
 
37
37
  def case(variant, &block)
38
38
  matcher = Matcher.new(all_variants: variants)
39
- matcher.instance_eval(&block)
39
+ if block.arity.zero?
40
+ matcher.instance_eval(&block)
41
+ else
42
+ yield matcher
43
+ end
40
44
  matcher.match_on(variant)
41
45
  end
42
46
 
@@ -60,10 +64,11 @@ module YaEnum
60
64
 
61
65
  next if missing_methods.empty?
62
66
 
63
- raise MissingMethods, <<~EOS
64
- Variant #{name} is missing the following methods:
65
- #{missing_methods.to_a.join(", ")}
66
- EOS
67
+ raise(
68
+ MissingMethods,
69
+ "Variant #{name} is missing the following methods:\n" \
70
+ " #{missing_methods.to_a.join(", ")}"
71
+ )
67
72
  end
68
73
  end
69
74
 
@@ -1,3 +1,3 @@
1
1
  module YaEnum
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ya_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Pedersen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler