skn_utils 3.3.9 → 3.3.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e0888077b5af6a475d4b67bf2793dc9ca38258c
|
4
|
+
data.tar.gz: 45ac9071cd4c71c4786ab0f2ee81399d339b495e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f37a9eeb506d09fe7c3dc9cb878b843770be0046942f522326285b660522b9114dc9d098a2d76fab26407d2fdb2c80269821df4294dc33a41d0a23bfd436672
|
7
|
+
data.tar.gz: de4b74eec5a97c63b6327d6ef66cba16835e32b7f30fffa26a87597bda7a983283306180528d00fb80b0d9b4f0f1f47db2a79f80b3b4d704370621c098efc8fe
|
data/README.md
CHANGED
@@ -90,6 +90,7 @@ Ruby Gem containing a Ruby PORO (Plain Old Ruby Object) that can be instantiated
|
|
90
90
|
#to_a -- returns Array of each value in the list
|
91
91
|
|
92
92
|
State
|
93
|
+
#node -- returns the current node (LinkedNode class)
|
93
94
|
#clear -- removes all elements and return number of elements removed
|
94
95
|
#empty? -- returns true if list has no elements, otherwise false
|
95
96
|
#size -- returns total count of elements in the list
|
@@ -133,9 +134,9 @@ Ruby Gem containing a Ruby PORO (Plain Old Ruby Object) that can be instantiated
|
|
133
134
|
|
134
135
|
Initialization: optional &block to identify data key
|
135
136
|
|
136
|
-
#call(*vargs, &block) -- Instansiates new list and
|
137
|
+
#call(*vargs, &block) -- Instansiates new list and creates nodes from each comma-seperated value;
|
137
138
|
also, assigns &block as default value identifier for find and sort operations
|
138
|
-
returns the first node
|
139
|
+
returns the first node -- else class instance
|
139
140
|
compare_key_block example: node = LinkedList.call({:key=>"Z"},{:key=>"S"},{:key=>"N"}) {|a| a[:key]}
|
140
141
|
|
141
142
|
|
@@ -73,7 +73,7 @@ module SknUtils
|
|
73
73
|
# return new size
|
74
74
|
def insert(value)
|
75
75
|
node = @current
|
76
|
-
@current = LinkNode.
|
76
|
+
@current = LinkNode.call(value, node, :circle_after, self, &@match_value)
|
77
77
|
if self.size == 0 # only
|
78
78
|
self.head = @current
|
79
79
|
self.tail = @current
|
@@ -89,7 +89,7 @@ module SknUtils
|
|
89
89
|
# return new size
|
90
90
|
def insert_before(position_value, value)
|
91
91
|
target = find_by_value(position_value)
|
92
|
-
node = LinkNode.
|
92
|
+
node = LinkNode.call(value, target, :circle_before, self, &@match_value)
|
93
93
|
@current = node
|
94
94
|
if self.size == 0 # only
|
95
95
|
self.head = node
|
@@ -105,7 +105,7 @@ module SknUtils
|
|
105
105
|
# return new size
|
106
106
|
def insert_after(position_value, value)
|
107
107
|
target = find_by_value(position_value)
|
108
|
-
node = LinkNode.
|
108
|
+
node = LinkNode.call(value, target, :circle_after, self, &@match_value)
|
109
109
|
@current = node
|
110
110
|
if self.size == 0 # only
|
111
111
|
self.head = node
|
@@ -71,7 +71,7 @@ module SknUtils
|
|
71
71
|
# return new size
|
72
72
|
def insert(value)
|
73
73
|
node = @current
|
74
|
-
@current = LinkNode.
|
74
|
+
@current = LinkNode.call(value, node, :after, self, &@match_value)
|
75
75
|
self.head = @current if self.head.nil?
|
76
76
|
self.tail = @current if self.tail.equal?(node)
|
77
77
|
self.size += 1
|
@@ -81,7 +81,7 @@ module SknUtils
|
|
81
81
|
# return new size
|
82
82
|
def insert_before(position_value, value)
|
83
83
|
target = find_by_value(position_value)
|
84
|
-
node = LinkNode.
|
84
|
+
node = LinkNode.call(value, target, :before, self, &@match_value)
|
85
85
|
@current = node if target
|
86
86
|
self.head = node if self.head.equal?(target)
|
87
87
|
self.tail = node if self.tail.nil?
|
@@ -91,7 +91,7 @@ module SknUtils
|
|
91
91
|
# return new size
|
92
92
|
def insert_after(position_value, value)
|
93
93
|
target = find_by_value(position_value)
|
94
|
-
node = LinkNode.
|
94
|
+
node = LinkNode.call(value, target, :after, self, &@match_value)
|
95
95
|
@current = node
|
96
96
|
self.head = node if self.head.nil?
|
97
97
|
self.tail = node if self.tail.equal?(target)
|
data/lib/skn_utils/version.rb
CHANGED