File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 >
Original file line number Diff line number Diff 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
6260end
You can’t perform that action at this time.
0 commit comments