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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64fe2d481e16251146a9cccd3c13e7a76d693a96
4
- data.tar.gz: 8b3167626ec20d68c1bfcc97bcfe18238370709b
3
+ metadata.gz: db34cbc61e929eb607b58f1682028288ad54d300
4
+ data.tar.gz: 19997a2b81da2b4446068f94a3a641e4e9dc3e21
5
5
  SHA512:
6
- metadata.gz: 92e457c945435384823cbae7aca0e0432543f5cb73f2033c757985923f4cc019a956e20c91289722a7df43eb90d7b2562d8472785adc9f88b118af8d05e700f5
7
- data.tar.gz: 356e52d4a5fc28987ea4467b472c8d6ba4bbfe46b8159da55333832e8be4e191b81052334ca6eb76bad13d9483e3dfc8caaadfa2804365b025ea3dbeecf9680c
6
+ metadata.gz: e7c53440130286c9518f74938bf5848bb5834d190eb7a7bcdedc2a098d3b96cb99e4832406ca1b3e81b57bee9614744259bf4b568f6f82cf16f3190482f56d5c
7
+ data.tar.gz: ea38865a74444eb17142be9f4c9580da94ec2a07e1f7ef005c3c39f1158b3c00732b2b8def2b690a99746030e33268e6755683fba00abc3b051500ba2df61277
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Qi
2
2
 
3
- [![Build Status](https://travis-ci.org/cyril/qi.svg?branch=master)][travis]
3
+ [![Build Status](https://travis-ci.org/cyril/qi.rb.svg?branch=master)][travis]
4
4
  [![Gem Version](https://badge.fury.io/rb/qi.svg)][gem]
5
- [![Inline docs](http://inch-ci.org/github/cyril/qi.svg?branch=master)][inchpages]
5
+ [![Inline docs](http://inch-ci.org/github/cyril/qi.rb.svg?branch=master)][inchpages]
6
6
  [![Documentation](http://img.shields.io/:yard-docs-38c800.svg)][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:0x007f8c0a82f300 @cells=[nil, nil, nil, nil, nil, nil, nil, nil]>
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::Result:0x007ff3539d71e8 @store=#<Qi::Store:0x007ff3539d7238 @cells=[nil, nil, nil, "p", nil, nil, nil, nil]>, @deleted_content=nil>
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
@@ -1 +1 @@
1
- 3.0.2
1
+ 4.0.0
@@ -0,0 +1 @@
1
+ bacf809a9ee2de6656c3180bd7200503004cfd3017472501854a6e73cab84fc02f37c1190fabc15d3f1ff7cedbc1a0ff5bae2391f4766b2d27819a57c8713661
@@ -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 :store do
13
- on :cells do
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
@@ -1,10 +1,15 @@
1
1
  module Qi
2
2
  # Main class.
3
3
  class Store
4
- # @param size [Fixnum] The number of cell.
5
- # @param options [Hash] A content per cell.
6
- def initialize(size, options = {})
7
- @cells = Array.new(size)
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
- new_store = self.class.new(cells.length, h)
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: 3.0.2
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
@@ -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