piece 0.1.1 → 0.1.2

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: 6c0e382628e754ff3f582c807b4bf0eaa886c7b7
4
- data.tar.gz: 0a47754336996a600d5bc2aab010474c0eef05d1
3
+ metadata.gz: 289a5f8c1c137ad1391abf6d9087ef97a4ae67f7
4
+ data.tar.gz: 405dedb61e347a8f317b72235b34b4fc80f3e18c
5
5
  SHA512:
6
- metadata.gz: 86432c9943f405ca9d6589a05982142ddc4cead8f420c470fc21a1f1441269cce2b22e6ab900f81fb417336f301539203965e809a5c57e15e8eaf9e8a306110f
7
- data.tar.gz: e7f0fcc690cbb437ed12eab042e7bf362f24ebb9329566789d527866a6709d7c69aeb7e9072ee8a56d7d6bdadd176e6edb61b9a404a2c8083482d2aa78c9d58b
6
+ metadata.gz: f2501af98f9d4e3a29ae02cd6dee95df081d2705311a48e8e9b524e406399260d80936422813c9b118161ec3a8ce70cd6469e100b330b9b3a21d8fd757233bcc
7
+ data.tar.gz: 05d2ec120b5289e5886e6824770b0062b78903549fd9283b42ce114eeeea60180a99d750772cfea3660936a32590586b6e60ba0aece8746480de4e1492e5bb78
data/lib/piece/pieces.rb CHANGED
@@ -35,13 +35,13 @@ module Piece
35
35
  raise "Unknown operator: #{group.op}"
36
36
  end
37
37
  when ExpressionParser::Id
38
- apply(group.val, keys)
39
- else
40
- if @data.has_key?(group)
41
- get(@data[group], keys)
38
+ if @data.has_key?(group.val)
39
+ get(@data[group.val], keys)
42
40
  else
43
- raise "Unknown group: #{group}"
41
+ get(group, keys)
44
42
  end
43
+ else
44
+ raise "Unknown type: #{group.inspect}"
45
45
  end
46
46
  end
47
47
 
@@ -54,12 +54,12 @@ module Piece
54
54
  get(data.first, keys) || get(data[1..-1], keys)
55
55
  when NilClass
56
56
  nil
57
- when ExpressionParser::Exp
58
- apply(data, keys)
59
57
  when ExpressionParser::Id
60
58
  match?(data.val, keys.first) ? '*' : nil
59
+ when String
60
+ apply(ExpressionParser.new.parse(data), keys)
61
61
  else
62
- get(ExpressionParser.new.parse(data), keys)
62
+ raise "Unknown type: #{group.inspect}"
63
63
  end
64
64
  end
65
65
 
data/lib/piece/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Piece
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piece
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Li