Questions tagged [ruby]
This challenge is related to the Ruby language. Note that challenges that require the answers to be in a specific language are generally discouraged.
6 questions
7
votes
1
answer
388
views
Generating versions of an array with elements changed in ruby
I'm new to code golf challenges. My problem came up in Advent of Code 2020 Day 8
The input is an array of arrays. In part two of the problem one needs to run several trials to produce a result by ...
5
votes
2
answers
463
views
Golf my iteration function
Here is my ungolfed Ruby code for a function I want to try and golf:
...
7
votes
2
answers
295
views
How to improve Ruby code under some restrictions
I'm (still) trying to make another submission to the Largest Number Printable question, and I've got the following bit of code:
...
14
votes
3
answers
2k
views
Advice for ruby
How can I shorten:
p=gets.to_i
a=gets
b=gets.to_i
If my input is an integer, followed by a string, followed by an integer?
20
votes
11
answers
2k
views
Crash IRB (interactive Ruby)
Ruby comes with a built-in REPL, which is quite handy.
Your challenge is to crash it in the least amount of code!
The definition of "crash" is "make it exit in an unintended way." This means ...
82
votes
53
answers
38k
views
Tips for golfing in Ruby
What general tips can you give for golfing in Ruby?
I'm looking for ideas that can be applied to code golf problems in general that are specific to Ruby. (For example, "Remove comments" would not be ...