qi 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/Rakefile +1 -1
- data/VERSION.semver +1 -1
- data/checksum/qi-5.0.0.gem.sha512 +1 -0
- data/fix/store_fix.rb +8 -0
- data/lib/qi/store.rb +19 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b71cc8f8f8249bea5ddb1b585a4fa0d114641ff9
|
4
|
+
data.tar.gz: 50c20bbcc0cce557118d7c805280b1e006b1976f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0ca154a36dfb588f6a29b3e092e62cd21a7feb1d4b5fe46ca4101fb7018afa84d35c6449e3d1071159658a90397a4643e607e39c94fa0d0e7f863cbf2daf784
|
7
|
+
data.tar.gz: f13fbe0ba4b0a1d80267fc5747e40aa78ab41031709cb7b627ddf39a6c6b7942add34a16e38e2f54975fe4fe95bbee3e8f7141df0545b1c7ba0ced6adcb82efb
|
data/README.md
CHANGED
@@ -33,11 +33,11 @@ Or install it yourself as:
|
|
33
33
|
```ruby
|
34
34
|
require 'qi'
|
35
35
|
|
36
|
-
db = Qi::Store.new(8) # => #<Qi::Store:
|
36
|
+
db = Qi::Store.new(8) # => #<Qi::Store:0x007fb79f09b8d0 @size=8, @captured=nil, @position={}>
|
37
37
|
|
38
|
-
result = db.call(2, 3, 'p') # => #<Qi::Store:
|
39
|
-
result.
|
40
|
-
result.
|
38
|
+
result = db.call(2, 3, 'p') # => #<Qi::Store:0x007fb79f091150 @size=8, @captured=nil, @position={3=>"p"}>
|
39
|
+
result.to_a # => [nil, nil, nil, "p", nil, nil, nil, nil]
|
40
|
+
result.captured # => nil
|
41
41
|
```
|
42
42
|
|
43
43
|
## Versioning
|
data/Rakefile
CHANGED
data/VERSION.semver
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.1.0
|
@@ -0,0 +1 @@
|
|
1
|
+
b4a7910e65556a19a74e0beffa3a00d05b38da150749ff73ea30df62aeaea2e6626a7680304a4bc62ccfd0850b6c948017e8ba4911b06adcd1162fa21b627a72
|
data/fix/store_fix.rb
CHANGED
@@ -8,6 +8,14 @@ Fix.describe Qi::Store do
|
|
8
8
|
it { MUST eql [nil, nil, nil, nil, nil, nil, nil, nil] }
|
9
9
|
end
|
10
10
|
|
11
|
+
on :call, 44, 3, 'p' do
|
12
|
+
it { MUST raise_exception ArgumentError }
|
13
|
+
end
|
14
|
+
|
15
|
+
on :call, 2, 444, 'p' do
|
16
|
+
it { MUST raise_exception ArgumentError }
|
17
|
+
end
|
18
|
+
|
11
19
|
on :captured do
|
12
20
|
it { MUST be_nil }
|
13
21
|
end
|
data/lib/qi/store.rb
CHANGED
@@ -5,24 +5,37 @@ module Qi
|
|
5
5
|
def initialize(size, captured = nil, position = {})
|
6
6
|
@size = Integer(size)
|
7
7
|
@captured = captured
|
8
|
-
@position = Hash(position.compact
|
9
|
-
|
10
|
-
freeze
|
8
|
+
@position = Hash(position).compact
|
11
9
|
end
|
12
10
|
|
13
11
|
def call(position_id, capture_position_id, content)
|
12
|
+
position_id = Integer(position_id)
|
13
|
+
capture_position_id = Integer(capture_position_id)
|
14
|
+
|
15
|
+
[position_id, capture_position_id].each do |id|
|
16
|
+
next if range.include?(id)
|
17
|
+
|
18
|
+
raise ArgumentError, "#{id} out of range"
|
19
|
+
end
|
20
|
+
|
14
21
|
self.class.new(
|
15
22
|
size,
|
16
23
|
position[capture_position_id],
|
17
24
|
position.merge(
|
18
|
-
|
19
|
-
|
25
|
+
position_id => nil,
|
26
|
+
capture_position_id => content
|
20
27
|
)
|
21
28
|
)
|
22
29
|
end
|
23
30
|
|
24
31
|
def to_a
|
25
|
-
|
32
|
+
range.map { |i| position[i] }
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def range
|
38
|
+
0...size
|
26
39
|
end
|
27
40
|
end
|
28
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- checksum/qi-3.0.1.gem.sha512
|
117
117
|
- checksum/qi-3.0.2.gem.sha512
|
118
118
|
- checksum/qi-4.0.0.gem.sha512
|
119
|
+
- checksum/qi-5.0.0.gem.sha512
|
119
120
|
- fix/store_fix.rb
|
120
121
|
- fix/support/coverage.rb
|
121
122
|
- lib/qi.rb
|