From 12e437b2eecbbf12f25cf55afbd2a5ab0c0b6ea3 Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Tue, 12 Nov 2024 20:20:06 -0800 Subject: [PATCH] [ruby/en] remove trailing spaces --- ruby.html.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ruby.html.markdown b/ruby.html.markdown index 578e8ef3..50c453da 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -91,7 +91,7 @@ false.class #=> FalseClass 2 <= 2 #=> true 2 >= 2 #=> true -# Combined comparison operator (returns `1` when the first argument is greater, +# Combined comparison operator (returns `1` when the first argument is greater, # `-1` when the second argument is greater, and `0` otherwise) 1 <=> 10 #=> -1 (1 < 10) 10 <=> 1 #=> 1 (10 > 1) @@ -268,7 +268,7 @@ puts("Some warnings occurred:\n" + warnings.join("\n")) if !warnings.empty? puts("Some warnings occurred:\n" + warnings.join("\n")) unless warnings.empty? # Loops -# In Ruby, traditional `for` loops aren't very common. Instead, these +# In Ruby, traditional `for` loops aren't very common. Instead, these # basic loops are implemented using enumerable, which hinges on `each`. (1..5).each do |counter| puts "iteration #{counter}" @@ -415,10 +415,10 @@ surround { puts 'hello world' } #=> hello world #=> } -# Blocks can be converted into a 'proc' object, which wraps the block +# Blocks can be converted into a 'proc' object, which wraps the block # and allows it to be passed to another method, bound to a different scope, # or manipulated otherwise. This is most common in method parameter lists, -# where you frequently see a trailing '&block' parameter that will accept +# where you frequently see a trailing '&block' parameter that will accept # the block, if one is given, and convert it to a 'Proc'. The naming here is # convention; it would work just as well with '&pineapple'. def guests(&block) @@ -426,7 +426,7 @@ def guests(&block) block.call(4) end -# The 'call' method on the Proc is similar to calling 'yield' when a block is +# The 'call' method on the Proc is similar to calling 'yield' when a block is # present. The arguments passed to 'call' will be forwarded to the block as arguments. guests { |n| "You have #{n} guests." } @@ -443,7 +443,7 @@ end upcased = ['Watch', 'these', 'words', 'get', 'upcased'].map(&:upcase) puts upcased #=> ["WATCH", "THESE", "WORDS", "GET", "UPCASED"] - + sum = [1, 2, 3, 4, 5].reduce(&:+) puts sum #=> 15 @@ -472,7 +472,7 @@ def best(first, second, third, *others) puts "There were #{others.count} other participants." end -best *ranked_competitors +best *ranked_competitors #=> Winners are John, Sally, and Dingus. #=> There were 2 other participants.