nuggets 1.2.0 → 1.2.1

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: b0b959bddb4e1b2d928bcb059f1ea972929212ba
4
- data.tar.gz: 21aa2cb33d3d74c60fcc464c8be1daf8048b0d4b
3
+ metadata.gz: 4f7723ca18083a47b25d3966ee9dfed33adc7380
4
+ data.tar.gz: 7d73e368f7e5818b7c83ec4ffb35d3e3fea5a0c0
5
5
  SHA512:
6
- metadata.gz: 8ecfb6dcc2afadaf74e24823fa679a54ce178a1312b3e16aad6d5149a5354ab6be1031e29683049667bf162d37b8bbe41e0ab83f79d80b4d10446b2dc3b5aa39
7
- data.tar.gz: 2f24ba68b5046c446abdc1352170009ad2b15a55b116a3cdea96fb5b633d20bc41d6109f9606dc0f4b6276524d509709c1192163f30118c70bbd2d88bbc21f96
6
+ metadata.gz: 46812ac2321ae75968d8937b45b325b71e541939b77af029caa3bd3749874a34c4981a8acfa07140325a1262d3f3cffd3898bd14c18a3dda7e8072818ea1c1b9
7
+ data.tar.gz: ccd5781ae98ea86765115ba317be282405a96f132d1666a7bb6070276c5de64ea52206e3fcc53320389e71df632b486c7e7b99aa2fb3f1aba7eb5bb96be50cca
data/ChangeLog CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  = Revision history for nuggets
4
4
 
5
+ == 1.2.1 [2015-04-14]
6
+
7
+ * Ruby Core compatibility for Enumerable#minmax etc. Issue #4 by @codez.
8
+
5
9
  == 1.2.0 [2015-03-13]
6
10
 
7
11
  * Extracted Nuggets::RubyMixin from Nuggets::Ruby.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to nuggets version 1.2.0.
5
+ This documentation refers to nuggets version 1.2.1.
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -3,7 +3,7 @@
3
3
  # #
4
4
  # nuggets -- Extending Ruby #
5
5
  # #
6
- # Copyright (C) 2007-2011 Jens Wille #
6
+ # Copyright (C) 2007-2015 Jens Wille #
7
7
  # #
8
8
  # Authors: #
9
9
  # Jens Wille <jens.wille@gmail.com> #
@@ -40,7 +40,9 @@ module Enumerable
40
40
  # Finds the maximum/minimum (or whatever +meth+ is) value in _enum_ according
41
41
  # to +by+ (which may be a symbol/string that is sent to each value, or a proc
42
42
  # that receives each value as parameter).
43
- def minmax_by(meth, by)
43
+ def minmax_by(meth = nil, by = nil, &block)
44
+ return _nuggets_original_minmax_by(&block) unless meth
45
+
44
46
  _by = by.is_a?(::Proc) ? by : lambda { |i| i.send(by) }
45
47
  send(meth) { |a, b| _by[a] <=> _by[b] }
46
48
  end
@@ -49,16 +51,18 @@ module Enumerable
49
51
  # enum.max_by(by) => aValue
50
52
  #
51
53
  # Maximum #minmax_by.
52
- def max_by(by)
53
- minmax_by(:max, by)
54
+ def max_by(by = nil, &block)
55
+ by.nil? || by.is_a?(::Numeric) ?
56
+ _nuggets_original_max_by(by, &block) : minmax_by(:max, by)
54
57
  end
55
58
 
56
59
  # call-seq:
57
60
  # enum.min_by(by) => aValue
58
61
  #
59
62
  # Minimum #minmax_by.
60
- def min_by(by)
61
- minmax_by(:min, by)
63
+ def min_by(by = nil, &block)
64
+ by.nil? || by.is_a?(::Numeric) ?
65
+ _nuggets_original_min_by(by, &block) : minmax_by(:min, by)
62
66
  end
63
67
 
64
68
  # call-seq:
@@ -68,7 +72,9 @@ module Enumerable
68
72
  #
69
73
  # Example:
70
74
  # %w[a bcd ef].max(:length) #=> 3
71
- def minmax(meth, what)
75
+ def minmax(meth = nil, what = nil, &block)
76
+ return _nuggets_original_minmax(&block) unless meth
77
+
72
78
  #m = minmax_by(meth, what)
73
79
  #what.is_a?(Proc) ? what[m] : m.send(what)
74
80
 
@@ -4,7 +4,7 @@ module Nuggets
4
4
 
5
5
  MAJOR = 1
6
6
  MINOR = 2
7
- TINY = 0
7
+ TINY = 1
8
8
 
9
9
  class << self
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuggets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -349,15 +349,13 @@ licenses:
349
349
  metadata: {}
350
350
  post_install_message: |2+
351
351
 
352
- nuggets-1.2.0 [2015-03-13]:
352
+ nuggets-1.2.1 [2015-04-14]:
353
353
 
354
- * Extracted Nuggets::RubyMixin from Nuggets::Ruby.
355
- * Added Net::SSH::Connection::Session#exec_sudo.
356
- * Added Hash.deproc.
354
+ * Ruby Core compatibility for Enumerable#minmax etc. Issue #4 by @codez.
357
355
 
358
356
  rdoc_options:
359
357
  - "--title"
360
- - nuggets Application documentation (v1.2.0)
358
+ - nuggets Application documentation (v1.2.1)
361
359
  - "--charset"
362
360
  - UTF-8
363
361
  - "--line-numbers"