qi 3.0.2 → 4.0.0
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 +4 -4
- data/README.md +7 -7
- data/VERSION.semver +1 -1
- data/checksum/qi-3.0.2.gem.sha512 +1 -0
- data/fix/store_fix.rb +26 -4
- data/lib/qi/store.rb +15 -9
- metadata +2 -2
- data/lib/qi/result.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db34cbc61e929eb607b58f1682028288ad54d300
|
4
|
+
data.tar.gz: 19997a2b81da2b4446068f94a3a641e4e9dc3e21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c53440130286c9518f74938bf5848bb5834d190eb7a7bcdedc2a098d3b96cb99e4832406ca1b3e81b57bee9614744259bf4b568f6f82cf16f3190482f56d5c
|
7
|
+
data.tar.gz: ea38865a74444eb17142be9f4c9580da94ec2a07e1f7ef005c3c39f1158b3c00732b2b8def2b690a99746030e33268e6755683fba00abc3b051500ba2df61277
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Qi
|
2
2
|
|
3
|
-
[][travis]
|
3
|
+
[][travis]
|
4
4
|
[][gem]
|
5
|
-
[][inchpages]
|
5
|
+
[][inchpages]
|
6
6
|
[][rubydoc]
|
7
7
|
|
8
8
|
> An ordered store of stuff to manage, for Ruby.
|
@@ -32,9 +32,9 @@ Or install it yourself as:
|
|
32
32
|
```ruby
|
33
33
|
require 'qi'
|
34
34
|
|
35
|
-
db = Qi::Store.new(8) # => #<Qi::Store:
|
35
|
+
db = Qi::Store.new(8) # => #<Qi::Store:0x007f82129493c8 @cells=[nil, nil, nil, nil, nil, nil, nil, nil], @deleted_content=nil>
|
36
36
|
|
37
|
-
result = db.call(2, 3, 'p') # => #<Qi::
|
37
|
+
result = db.call(2, 3, 'p') # => #<Qi::Store:0x007f821293a170 @cells=[nil, nil, nil, "p", nil, nil, nil, nil], @deleted_content=nil>
|
38
38
|
result.store.cells # => [nil, nil, nil, "p", nil, nil, nil, nil]
|
39
39
|
result.deleted_content # => nil
|
40
40
|
```
|
@@ -45,7 +45,7 @@ __Qi__ follows [Semantic Versioning 2.0](http://semver.org/).
|
|
45
45
|
|
46
46
|
## Contributing
|
47
47
|
|
48
|
-
1. [Fork it](https://github.com/cyril/qi/fork)
|
48
|
+
1. [Fork it](https://github.com/cyril/qi.rb/fork)
|
49
49
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
50
50
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
51
51
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -56,6 +56,6 @@ __Qi__ follows [Semantic Versioning 2.0](http://semver.org/).
|
|
56
56
|
See `LICENSE.md` file.
|
57
57
|
|
58
58
|
[gem]: https://rubygems.org/gems/qi
|
59
|
-
[travis]: https://travis-ci.org/cyril/qi
|
60
|
-
[inchpages]: http://inch-ci.org/github/cyril/qi/
|
59
|
+
[travis]: https://travis-ci.org/cyril/qi.rb
|
60
|
+
[inchpages]: http://inch-ci.org/github/cyril/qi.rb/
|
61
61
|
[rubydoc]: http://rubydoc.info/gems/qi/frames
|
data/VERSION.semver
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
4.0.0
|
@@ -0,0 +1 @@
|
|
1
|
+
bacf809a9ee2de6656c3180bd7200503004cfd3017472501854a6e73cab84fc02f37c1190fabc15d3f1ff7cedbc1a0ff5bae2391f4766b2d27819a57c8713661
|
data/fix/store_fix.rb
CHANGED
@@ -8,16 +8,38 @@ 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 :deleted_content do
|
12
|
+
it { MUST be_nil }
|
13
|
+
end
|
14
|
+
|
11
15
|
on :call, 2, 3, 'p' do
|
12
|
-
on :
|
13
|
-
|
14
|
-
it { MUST eql [nil, nil, nil, 'p', nil, nil, nil, nil] }
|
15
|
-
end
|
16
|
+
on :cells do
|
17
|
+
it { MUST eql [nil, nil, nil, 'p', nil, nil, nil, nil] }
|
16
18
|
end
|
17
19
|
|
18
20
|
on :deleted_content do
|
19
21
|
it { MUST be_nil }
|
20
22
|
end
|
23
|
+
|
24
|
+
on :call, 2, 4, 'K' do
|
25
|
+
on :cells do
|
26
|
+
it { MUST eql [nil, nil, nil, 'p', 'K', nil, nil, nil] }
|
27
|
+
end
|
28
|
+
|
29
|
+
on :deleted_content do
|
30
|
+
it { MUST be_nil }
|
31
|
+
end
|
32
|
+
|
33
|
+
on :call, 3, 4, 'p' do
|
34
|
+
on :cells do
|
35
|
+
it { MUST eql [nil, nil, nil, nil, 'p', nil, nil, nil] }
|
36
|
+
end
|
37
|
+
|
38
|
+
on :deleted_content do
|
39
|
+
it { MUST eql 'K' }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
21
43
|
end
|
22
44
|
end
|
23
45
|
end
|
data/lib/qi/store.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
module Qi
|
2
2
|
# Main class.
|
3
3
|
class Store
|
4
|
-
# @
|
5
|
-
#
|
6
|
-
|
7
|
-
|
4
|
+
# @example Instanciate a store with 88 cells.
|
5
|
+
# new(88)
|
6
|
+
#
|
7
|
+
# @param size [Fixnum] The number of cell.
|
8
|
+
# @param deleted_content [Object, nil] Deleted content.
|
9
|
+
# @param options [Hash] A content per cell.
|
10
|
+
def initialize(size, deleted_content = nil, options = {})
|
11
|
+
@cells = Array.new(size)
|
12
|
+
@deleted_content = deleted_content
|
8
13
|
|
9
14
|
options.each do |cell, piece|
|
10
15
|
@cells[cell] = piece
|
@@ -16,6 +21,11 @@ module Qi
|
|
16
21
|
# @return [Array] The cells in the store.
|
17
22
|
attr_reader :cells
|
18
23
|
|
24
|
+
# @!attribute [r] deleted_content
|
25
|
+
#
|
26
|
+
# @return [Object, nil] Deleted content.
|
27
|
+
attr_reader :deleted_content
|
28
|
+
|
19
29
|
# @param src_cell [Fixnum] Source cell.
|
20
30
|
# @param dst_cell [Fixnum] Destination cell.
|
21
31
|
# @param content [Object] Content.
|
@@ -27,9 +37,7 @@ module Qi
|
|
27
37
|
deleted_content = h.delete(dst_cell)
|
28
38
|
h[dst_cell] = content
|
29
39
|
|
30
|
-
|
31
|
-
|
32
|
-
Result.new(new_store, deleted_content)
|
40
|
+
self.class.new(cells.length, deleted_content, h)
|
33
41
|
end
|
34
42
|
|
35
43
|
private
|
@@ -40,5 +48,3 @@ module Qi
|
|
40
48
|
end
|
41
49
|
end
|
42
50
|
end
|
43
|
-
|
44
|
-
require_relative 'result'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Wack
|
@@ -114,10 +114,10 @@ files:
|
|
114
114
|
- bin/setup
|
115
115
|
- checksum/qi-3.0.0.gem.sha512
|
116
116
|
- checksum/qi-3.0.1.gem.sha512
|
117
|
+
- checksum/qi-3.0.2.gem.sha512
|
117
118
|
- fix/store_fix.rb
|
118
119
|
- fix/support/coverage.rb
|
119
120
|
- lib/qi.rb
|
120
|
-
- lib/qi/result.rb
|
121
121
|
- lib/qi/store.rb
|
122
122
|
- pkg_checksum
|
123
123
|
- qi.gemspec
|
data/lib/qi/result.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Qi
|
2
|
-
# Result class.
|
3
|
-
class Result
|
4
|
-
# @param store [Store] Collection of data.
|
5
|
-
# @param deleted_content [Object, nil] Last deleted content.
|
6
|
-
def initialize(store, deleted_content)
|
7
|
-
@store = store
|
8
|
-
@deleted_content = deleted_content
|
9
|
-
end
|
10
|
-
|
11
|
-
# @!attribute [r] store
|
12
|
-
#
|
13
|
-
# @return [Store] Collection of data.
|
14
|
-
attr_reader :store
|
15
|
-
|
16
|
-
# @!attribute [r] deleted_content
|
17
|
-
#
|
18
|
-
# @return [Symbol, nil] Last deleted content.
|
19
|
-
attr_reader :deleted_content
|
20
|
-
end
|
21
|
-
end
|