cotcube-helpers 0.1.7.3 → 0.1.7.4

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
  SHA256:
3
- metadata.gz: 93dafb52f8ac98f974e664aa75c8ffec500d8e97424f4d8018632ebf2593b591
4
- data.tar.gz: 4ebb3c134a1d4fcf498fbc1514649e072283f8f30071a8c668db7a483801e649
3
+ metadata.gz: a685d90173074f0ee3490602a9108cec0f8a8ff6e616fce2db1ef3566d0f2ef6
4
+ data.tar.gz: b08e52e6e47a233658765b4fdb3aab72d649aefff91eabb46e8cbcef6542e84e
5
5
  SHA512:
6
- metadata.gz: 4b89d9ba9ace8dea6e88cbefc5caf8a56ea923d2130850eee74e5fca2c888b35994841225ccf96f64bcf73eb650febefb15508704ba01f704afceb49f7efdc15
7
- data.tar.gz: 0722b12dff36977b75f53988a1563310438ff9ed445b8d563b76fe522e5116f55b291e4bf46924611bf0b5886a71a82f53b14e915b34c0d071e3f0e6112bc06e
6
+ metadata.gz: b8ced4fffb8f219416f05fe6daf3e891499e788d58d1ca4ea233cfff18998972b3aa9f0be10abdda3081671e534d0346201cfa7f5442b0bc996b75a6f3b1208b
7
+ data.tar.gz: 853ae393f9f3ba54321d82d2dba17e61fd6f85a4609029dee619ddcab10b2c2e5aa5dd6e7105f3f88e1e072b60034f7657a4cb53baed8188ddb67347326bce7a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.7.4 (March 13, 2021)
2
+ - hotfix on 0.1.7.3
3
+
1
4
  ## 0.1.7.3 (March 13, 2021)
2
5
  - array_ext: pairwise and triplewise now support saving result in latter members []=
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7.3
1
+ 0.1.7.4
@@ -47,7 +47,7 @@ class Array
47
47
  # same as pairwise, but with arity of three
48
48
  def triplewise(ret=nil, &block)
49
49
  raise ArgumentError, 'Array.triplewise needs an arity of 3 (i.e. |a, b, c|)' unless block.arity == 3
50
- raise ArgumentError, 'Each element of Array should respond to []=, at least the last one fails. unless self.last.respond_to?(:[]=)
50
+ raise ArgumentError, 'Each element of Array should respond to []=, at least the last one fails.' unless self.last.respond_to?(:[]=)
51
51
  return [] if size <= 2
52
52
 
53
53
  each_index.map do |i|
@@ -65,37 +65,37 @@ class Array
65
65
  unless attr.nil? || first[attr]
66
66
  raise ArgumentError,
67
67
  "At least first element of Array '#{first}' does not contain attr '#{attr}'!"
68
- end
69
- raise ArgumentError, 'Ranges should be an Array or, more precisely, respond_to :map' unless ranges.respond_to? :map
70
- raise ArgumentError, 'Each range in :ranges should respond to .include!' unless ranges.map do |x|
71
- x.respond_to? :include?
72
- end.reduce(:&)
73
-
74
- select do |el|
75
- value = attr.nil? ? el : el[attr]
76
- ranges.map do |range|
77
- range.include?(block.nil? ? value : block.call(value))
78
- end.reduce(:|)
79
- end
80
68
  end
69
+ raise ArgumentError, 'Ranges should be an Array or, more precisely, respond_to :map' unless ranges.respond_to? :map
70
+ raise ArgumentError, 'Each range in :ranges should respond to .include!' unless ranges.map do |x|
71
+ x.respond_to? :include?
72
+ end.reduce(:&)
73
+
74
+ select do |el|
75
+ value = attr.nil? ? el : el[attr]
76
+ ranges.map do |range|
77
+ range.include?(block.nil? ? value : block.call(value))
78
+ end.reduce(:|)
79
+ end
80
+ end
81
81
 
82
- def select_right_by(inclusive: false, exclusive: false, initial: [], &block)
83
- # unless range.is_a? Range and
84
- # (range.begin.nil? or range.begin.is_a?(Integer)) and
85
- # (range.end.nil? or range.end.is_a?(Integer))
86
- # raise ArgumentError, ":range, if given, must be a range of ( nil|Integer..nil|Integer), got '#{range}'"
87
- # end
82
+ def select_right_by(inclusive: false, exclusive: false, initial: [], &block)
83
+ # unless range.is_a? Range and
84
+ # (range.begin.nil? or range.begin.is_a?(Integer)) and
85
+ # (range.end.nil? or range.end.is_a?(Integer))
86
+ # raise ArgumentError, ":range, if given, must be a range of ( nil|Integer..nil|Integer), got '#{range}'"
87
+ # end
88
88
 
89
- raise ArgumentError, 'No block given.' unless block.is_a? Proc
89
+ raise ArgumentError, 'No block given.' unless block.is_a? Proc
90
90
 
91
- inclusive = true unless exclusive
92
- if inclusive && exclusive
93
- raise ArgumentError,
94
- "Either :inclusive or :exclusive must remain falsey, got '#{inclusive}' and '#{exclusive}'"
95
- end
91
+ inclusive = true unless exclusive
92
+ if inclusive && exclusive
93
+ raise ArgumentError,
94
+ "Either :inclusive or :exclusive must remain falsey, got '#{inclusive}' and '#{exclusive}'"
95
+ end
96
96
 
97
- index = find_index { |obj| block.call(obj) }
97
+ index = find_index { |obj| block.call(obj) }
98
98
 
99
- self[((inclusive ? index : index + 1)..)]
100
- end
99
+ self[((inclusive ? index : index + 1)..)]
100
+ end
101
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cotcube-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7.3
4
+ version: 0.1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin L. Tischendorf