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.

Filter by
Sorted by
Tagged with
7 votes
1 answer

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 ...
user avatar
5 votes
2 answers

Golf my iteration function

Here is my ungolfed Ruby code for a function I want to try and golf: ...
user avatar
7 votes
2 answers

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: ...
user avatar
13 votes
3 answers

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?
user avatar
  • 131
20 votes
11 answers

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 ...
user avatar
  • 70.6k
77 votes
53 answers

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 ...
user avatar
  • 1,257