Skip to content

Commit 722e4b4

Browse files
committed
revert max, min
1 parent 69c2997 commit 722e4b4

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

lib/jruby_art/helper_methods.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,19 @@ def thread(&block)
7676

7777
# explicitly provide 'processing.org' min instance method
7878
# to return a float:- a, b and c need to be floats
79+
# you might choose to use ruby method directly and then
80+
# provide a block to alter comparator eg
81+
# args.min(&block) # { |a, b| a.value <=> b.value }
7982

80-
def min(args, &block)
81-
args.min unless block_given?
82-
args.min(&block) # { |a, b| a.value <=> b.value }
83+
def min(*args)
84+
args.min
8385
end
8486

8587
# explicitly provide 'processing.org' max instance method
86-
# to return a float:- a, b and c need to be floats
88+
# to return a float:- a, b and c need to be floats see above
8789

88-
def max(args, &block)
89-
args.max unless block_given?
90-
args.max(&block) # { |a, b| a.value <=> b.value }
90+
def max(*args)
91+
args.max
9192
end
9293

9394
# explicitly provide 'processing.org' dist instance method

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
1111
<modelVersion>4.0.0</modelVersion>
1212
<groupId>ruby-processing</groupId>
1313
<artifactId>rp5extras</artifactId>
14-
<version>1.2.9</version>
14+
<version>1.3.0</version>
1515
<name>rp5extras</name>
1616
<description>rp5extras for JRubyArt</description>
1717
<url>https://github.com/ruby-processing/JRubyArt</url>

test/helper_methods_test.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ def test_dist
5151
end
5252

5353
def test_min
54-
assert_equal(min(ARRAY), 'albatross')
55-
assert_equal(min(ARRAY) { |a, b| a.length <=> b.length }, 'dog')
54+
assert_equal(min(*ARRAY), 'albatross')
5655
end
5756

5857
def test_max
59-
assert_equal(max(ARRAY), 'horse')
60-
assert_equal(max(ARRAY) { |a, b| a.length <=> b.length }, 'albatross')
58+
assert_equal(max(*ARRAY), 'horse')
6159
end
6260
end

0 commit comments

Comments
 (0)