circular_linked 0.0.1 → 0.1.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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/LICENSE +21 -0
  4. data/README.md +75 -0
  5. data/circular_linked.gemspec +11 -0
  6. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eaddc29746a2d99c05aadcf1e490004f23683178dc49afd5293656c3edceded
4
- data.tar.gz: 3c906b3079d972ceadad706bcb3cf93749600c24d3b4ebbad7f91cd19df91555
3
+ metadata.gz: 2ee4718ad6b13d0e668d8f05e492b7f598bd71d283ce08f2a8ba74375de0d9b0
4
+ data.tar.gz: 3179b128f466ad9903afb558cb8e267df7efda588276038a6181e5968a65d251
5
5
  SHA512:
6
- metadata.gz: d583d18873400eec464d1d708aa3b1d4791c1cc38af6b824a2b9f904be4633882b42eaeda58627608159e6da40f58eed5051824c38cc03f34ca6051b187f513b
7
- data.tar.gz: 2034ffcd127a04c5d6b1e4a9fce71580b4caddddf6c92525399fb57e036a8ab931ee4f4e3a72e2e792732894fdfb1578fcbdc6ee707436b4df7d271a08a7344e
6
+ metadata.gz: 4750dd9ec7c3f4d67eae36551866d5c46c2a82f0224e681f4fe23147c5b8848068426a2f957f3efaaaf54ef2d40907274c24e394f50d3bc00a7b14ec079ef53a
7
+ data.tar.gz: 508684fdb577837bef65dba842aca84e4dc8973631196e0d99870cd917f2bb25b617cf2eb6d6f0974c9bcc48037a582733afd4aa288c19c574cfc268005ae622
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ .gem/
3
+ Gemfile.lock
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Gabriela Matos Guedes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # Circular Linked List
2
+
3
+ Implementation for the circular linked list data structure for Ruby.
4
+
5
+ List is composed by nodes, which have each one a value and a next item.
6
+
7
+ ## Installation
8
+
9
+ Just add to your Gemfile:
10
+
11
+ ```
12
+ gem "circular_linked"
13
+ ```
14
+
15
+ Then
16
+
17
+ ```
18
+ $ bundle install
19
+ ```
20
+
21
+ Or you can install the gem directly from terminal:
22
+
23
+ ```
24
+ $ gem install circular_linked
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```ruby
30
+ items_list = CircularLinked::List.new(1, 2, 3)
31
+ empty_list = CircularLinked::List.new
32
+
33
+ items_list.head #=> #<Node:0x... @value=1 ...
34
+ empty_list.head #=> nil
35
+
36
+ items_list.add(4) # List now have nodes with the values: 1, 2, 3, 4
37
+
38
+ items_list.last_node #=> 4
39
+ empty_list.last_node #=> nil
40
+
41
+ items_list.find(2) #=> #<Node:0x... @value=2 ...
42
+ empty_list.find(2) #=> nil
43
+
44
+ items_list.remove(3) # List now have nodes with the values: 1, 2, 4
45
+ empty_list.remove(3) # List remains empty
46
+
47
+ items_list.items_value #=> [1,2,4]
48
+ empty_list.items_value #=> []
49
+
50
+ items_list.length #=> 3
51
+ empty_list.length #=> 0
52
+
53
+ items_list.each {|node| puts node.value }
54
+ #=> 1
55
+ #=> 2
56
+ #=> 4
57
+ empty_list.each {|node| puts node.value }
58
+ #=>
59
+ ```
60
+
61
+ ## Development
62
+
63
+ Just run `bundle install` to install the dependencies and you are ready.
64
+
65
+ ## Tests
66
+
67
+ To run the specs, after installing the dependecies as said above, you can just run in the main folder:
68
+
69
+ ```
70
+ $ rspec .
71
+ ```
72
+
73
+ ## Contributing
74
+
75
+ Feel free to open pull requests/issues or to fork this repo.
@@ -0,0 +1,11 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'circular_linked'
3
+ s.version = '0.1.1'
4
+ s.summary = 'Circular Linked List implementation'
5
+ s.description = 'Provides a circular linked list data structure for Ruby with the most common methods'
6
+ s.authors = ['Gabriela Guedes']
7
+ s.email = 'gabriela.guedes.gmg@gmail.com'
8
+ s.files = `git ls-files`.split("\n")
9
+ s.homepage = 'https://github.com/GabrielaGuedes/circular_linked'
10
+ s.license = 'MIT'
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circular_linked
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriela Guedes
@@ -17,14 +17,18 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".gitignore"
20
21
  - Gemfile
21
22
  - Gemfile.lock
23
+ - LICENSE
24
+ - README.md
25
+ - circular_linked.gemspec
22
26
  - lib/circular_linked.rb
23
27
  - lib/circular_linked/list.rb
24
28
  - lib/circular_linked/node.rb
25
29
  - spec/circular_linked/list_spec.rb
26
30
  - spec/circular_linked/node_spec.rb
27
- homepage:
31
+ homepage: https://github.com/GabrielaGuedes/circular_linked
28
32
  licenses:
29
33
  - MIT
30
34
  metadata: {}