rb_lovely 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67d03675c3c6b63a3ebfd789c053a98df9b4a55c
4
- data.tar.gz: c77b233b9b82b11f00f1d0fb37ed1ac7be8d8c17
3
+ metadata.gz: a3f7d4f5fc6ca3c627d4ad35b98c0f935d98a118
4
+ data.tar.gz: c3ea2e3558250ccc28c80ba638b511338ee2815f
5
5
  SHA512:
6
- metadata.gz: 8605022a32d4df8a51bfd6460774f64ea8fef9983f028f4eab839f663c6d5ec671b3d450c91525b84ff8f980e4e670f632f136cf9b022584749addb48512fe70
7
- data.tar.gz: 256fbbace880eca76a8a3373e1622c57a9ac34324580f9904311770abd3b10579dfbb9ff719cfbcd7357dfdfd499440846594225b31bfda3b640f1cfc0afe55b
6
+ metadata.gz: cdea171a98d780d43ff3d91b9375c646c997a1a12d0e2eb851974e731538637f82260c4d5b12b0d79d264fa37a4d60301b11b80ee6dffd829a2117e47d0a87e8
7
+ data.tar.gz: 145a2c7665ed69d6dcdeff8b82bb4d6972aa59456d0698fdf1e31e2b956286e8ec25f089bda951c564bac5ed16eca410f9f391d18030fa33ed35cee1e9f177da
@@ -309,6 +309,7 @@ extern "C" {
309
309
  rb_define_method(rbHash, "[]", RUBY_METHOD_FUNC(hashGet), 1);
310
310
  rb_define_method(rbHash, "each", RUBY_METHOD_FUNC(hashEach), 0);
311
311
  rb_define_method(rbHash, "to_s", RUBY_METHOD_FUNC(hashToString), 0);
312
+ rb_define_method(rbHash, "inspect", RUBY_METHOD_FUNC(hashToString), 0);
312
313
  rb_define_method(rbHash, "first", RUBY_METHOD_FUNC(hashFirst<ValueOrKey::BOTH>), 0);
313
314
  rb_define_method(rbHash, "first_value", RUBY_METHOD_FUNC(hashFirst<ValueOrKey::VALUE>), 0);
314
315
  rb_define_method(rbHash, "first_key", RUBY_METHOD_FUNC(hashFirst<ValueOrKey::KEY>), 0);
@@ -231,6 +231,7 @@ extern "C" {
231
231
  rb_define_method(rbSet, "<<", RUBY_METHOD_FUNC(setAdd), 1);
232
232
  rb_define_method(rbSet, "each", RUBY_METHOD_FUNC(setEach), 0);
233
233
  rb_define_method(rbSet, "to_s", RUBY_METHOD_FUNC(setToString), 0);
234
+ rb_define_method(rbSet, "inspect", RUBY_METHOD_FUNC(setToString), 0);
234
235
  rb_define_method(rbSet, "first", RUBY_METHOD_FUNC(setFirst), 0);
235
236
  rb_define_method(rbSet, "last", RUBY_METHOD_FUNC(setLast), 0);
236
237
  rb_define_method(rbSet, "delete", RUBY_METHOD_FUNC(setMutatingDelete), 1);
data/yard.rb CHANGED
@@ -161,10 +161,14 @@ module RbLovely
161
161
  # expect(hash[:y]).to equal 4
162
162
  # expect(hash.length).to equal 3
163
163
  # expect(hash.to_a).to eql [[:i, 1], [:y, 4], [:b, 16]]
164
+ #
165
+ # # reverse order by overriding key comparison function.
166
+ # rhash = RbLovely::SortedHash(compare: proc { |a, b| b <=> a })
164
167
  class SortedHash
165
168
  include Enumerable
166
169
 
167
170
  # @complexity O(n).
171
+ # @see .[]
168
172
  # @param content [Array] An array containing key, value, key, value ...
169
173
  # @param compare [Proc] Comparison function used to order values (rather than default
170
174
  # of using <=> method).
@@ -189,15 +193,18 @@ module RbLovely
189
193
  # expect(hash.to_a).to eql [[:b, 1], [:a, 3]]
190
194
  def self.[](*content) ; end
191
195
 
192
- # Set the value associated with a key. If the key already then it and its value are removed.
196
+ # Set the value associated with a key, replacing the existing key's value.
193
197
  # @complexity O(c).
198
+ # @see #replace
194
199
  # @return The value that was passed.
195
200
  # @example
196
201
  # hash = RbLovely::SortedHash.new
197
202
  # hash[:a] = 'yo'
198
203
  def []=(key, value) ; end
199
204
 
200
- # Set the value associated with a key. If the key already then it and its value are removed.
205
+ # Set the value associated with a key, differs to #[]= in return value.
206
+ # @complexity O(c).
207
+ # @see #[]=
201
208
  # @return The value that was previously associated with the key or nil if the key was not present in the hash.
202
209
  # @example
203
210
  # hash = RbLovely::SortedHash[:a, 'yi']
@@ -222,7 +229,7 @@ module RbLovely
222
229
  # hash.each { |key, value| puts "#{key} => #{value}" }
223
230
  def each(&block) ; end
224
231
 
225
- # Remove all values from the hash.
232
+ # Remove all key-value pairs from the hash.
226
233
  # @complexity O(n)
227
234
  # @example
228
235
  # hash = RbLovely::SortedHash [:a, 10]
@@ -230,7 +237,8 @@ module RbLovely
230
237
  # expect(hash.empty?).to equal true
231
238
  def clear ; end
232
239
 
233
- # Retrieve value associated with the corresponding key or nil if the key doesn't exist.
240
+ # Retrieve value from hash using key.
241
+ # @return Value associated with the corresponding key or nil if the key doesn't exist.
234
242
  # @complexity O(c)
235
243
  # @example
236
244
  # hash = RbLovely::SortedHash [:a, 2]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb_lovely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike