linked_list_sourav 0.0.4 → 0.0.5

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/linked_list.rb +8 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f6a6a8da59e3743061f5257c39480d8eedc3e09
4
- data.tar.gz: b0cdafe2e7dac718e0788c24c156e8bc22a058e2
3
+ metadata.gz: 250fa17879a124ffde4d0c9929c735935429634f
4
+ data.tar.gz: b73428291b8d8b7e84835e76fa70a6a9343d09c7
5
5
  SHA512:
6
- metadata.gz: cfb17c6d2c6844d86828c30de147ea67187baf849f9b8db61998f3f63c387aafa5110f9527528f2d43f36892cb6a0976c145220f673b5404c35aa22c9dc88dd6
7
- data.tar.gz: b5908d345d16272df8c87fcdf111624c3cacdcc4e3f1f140c6ba5c401651d2929bd90307595eef95af6595d83073207f12671d6eee1d18073ab0eddde816906f
6
+ metadata.gz: 579307e133e1b39b1504c9446636b1dfb0f8a7626d21464575fd2cd3010976e8ecd1fe1dba82c479820b56ce6fa51d32cae5983fd820ac538d4adc396760bcfd
7
+ data.tar.gz: 5daaf83963d4960fcf175ca430080b551bb0bb67381538609f6837cc061ce682abfa4acf8538a163c40140e9ad022129d5d3bd4223678dc8956620e8ab353ecf
data/lib/linked_list.rb CHANGED
@@ -13,7 +13,7 @@ module LinkedList
13
13
  end
14
14
  end
15
15
 
16
- class SinglyLinkedList
16
+ class Singly
17
17
  def initialize(data) # constructor
18
18
  if data.class == Array
19
19
  @head = Node.new(data[0])
@@ -64,6 +64,13 @@ module LinkedList
64
64
  self
65
65
  end
66
66
 
67
+ def edit(old_data, new_data)
68
+ node = find(old_data)
69
+ if node
70
+ node.data = new_data
71
+ end
72
+ end
73
+
67
74
  def to_a # returns an array of all data
68
75
  node = @head
69
76
  array = Array.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linked_list_sourav
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sourav Moitra