patm 2.0.0 → 2.0.1

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
  SHA1:
3
- metadata.gz: d2a4036ae8e3a9b302bd189406ebb284f3efcc54
4
- data.tar.gz: 10b6f6831b67755280f6e6ba5faf145a3ddf8910
3
+ metadata.gz: 64949366066d3d6c55747fc4de1163fc77624491
4
+ data.tar.gz: 84b8d7f389aa5be66d911c42cb8c9d25041657b8
5
5
  SHA512:
6
- metadata.gz: 50f3198622f079bc716eb064a4e8cfbdad3f63bfd6f7c9f76c750fefd35e86301513c79542b777c5c4d7594165632acdcbb00e213661a544cc8e61fbf439ef72
7
- data.tar.gz: 093665d2fcb727165d6fda3cd9c214805be766f70b15cf565ec7670aa585a21c280514687298dd2aa64558248633fbee7f815f836a9e6207c00ced7ece6e2b7e
6
+ metadata.gz: 9f4e569ff98ea968a05c736076b01eb8e8d33a2f10a40879e4ec02a5db58c16389dee0c694ca4d2c1dc979de4a46ace0f72d9eba82c9e044012ba12655da5360
7
+ data.tar.gz: 098c8031f081a57b2958cde2f9643e7a053d1c9c4871ed449690895e95594a91e0a48a0ff8338c5cb967e63315d80a40cc231ceb4b8c662a1bcd6ec9efc0dfb1
data/README.md CHANGED
@@ -140,7 +140,12 @@ Captured values are accessible through `Match#_1, _2, ...` and `Match#[capture_n
140
140
 
141
141
  ## Changes
142
142
 
143
- ### 2.0.0(Unreleased)
143
+ ### 2.0.1
144
+
145
+ - Bugfix: About pattern `Patm._1 & Array`.
146
+ - Bugfix: Compiler bug fix.
147
+
148
+ ### 2.0.0
144
149
 
145
150
  - Named capture
146
151
  - Patm::GROUPS is obsolete. Use `pattern[number_or_name]` or `Patm._1, _2, ...` instead.
@@ -62,7 +62,7 @@ module Patm
62
62
  end
63
63
 
64
64
  def &(rhs)
65
- And.new([self, rhs])
65
+ And.new([self, Pattern.build_from(rhs)])
66
66
  end
67
67
 
68
68
  def [](name)
@@ -340,7 +340,11 @@ module Patm
340
340
  ctxs = []
341
341
  @pats.each do|pat|
342
342
  s, c, i = pat.compile_internal(i, target_name)
343
- srcs << s
343
+ if !s && @op_str == '||' # dirty...
344
+ srcs << 'true'
345
+ else
346
+ srcs << s
347
+ end
344
348
  ctxs << c
345
349
  end
346
350
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = 'patm'
4
- s.version = '2.0.0'
4
+ s.version = '2.0.1'
5
5
  s.summary = 'PATtern Matching library'
6
6
  s.description = 'Pattern matching library for plain data structure'
7
7
  s.required_ruby_version = '>= 1.9.0'
@@ -274,5 +274,13 @@ describe Patm::Pattern do
274
274
  it { should match_to([1, 2, [10, 3], 4]).and_capture([]) }
275
275
  it { should match_to([1, 2, [10, 3], 20, 4]).and_capture([20]) }
276
276
  end
277
+ pattern Patm._1&Array do
278
+ it { should_not match_to(1) }
279
+ it { should match_to([]).and_capture([]) }
280
+ end
281
+ pattern Patm.or(1, Patm._any) do
282
+ it { should match_to(1) }
283
+ it { should match_to(999) }
284
+ end
277
285
  end
278
286
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - todesking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-10 00:00:00.000000000 Z
11
+ date: 2014-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec