Skip to main content

Questions tagged [ruby]

Ruby is a multi-platform, open-source, dynamic, object-oriented, interpreted language created by Yukihiro Matsumoto (Matz) in 1993.

Filter by
Sorted by
Tagged with
3 votes
1 answer
72 views

I have implemented my own version of Ruby's Array uniq-method (Ruby docs - Class array) as a monkey patch on Array. Method-impl.: ...
michael.zech's user avatar
  • 5,044
6 votes
2 answers
459 views

Link to kata: linkRank: 6 kyuKata author: @rsalgado I have been recently learning Ruby-lang and have been attempting to solve the following kata from Codewars involving Goldbach's Conjecture: ...
CrSb0001's user avatar
  • 619
4 votes
1 answer
212 views

I like to have a script which fetches data from a REST-API then writes the data into a CSV file. Here's what I've got so far (prototype, using a publicly accessible dummy-API): ...
michael.zech's user avatar
  • 5,044
5 votes
3 answers
135 views

I have written a method, which checks for Palindrome and attached it to the String-class. Here's the code: ...
michael.zech's user avatar
  • 5,044
2 votes
1 answer
85 views

previusly I make a post for Session Logic for User Verification in Rails Migration. Now the improvement version following advice of the comments is here. The problem was the use of `` for executing in ...
ZAMA's user avatar
  • 55
1 vote
1 answer
124 views

The task A file similar to the following is provided. ...
francesco's user avatar
3 votes
3 answers
177 views

Task Write a Ruby function, which accepts a path to a text file and returns a string consisting of the last n lines in reversed order, separated by commas. Example input file: ...
michael.zech's user avatar
  • 5,044
1 vote
4 answers
287 views

Task: Implement a function which loops from 1 to 100 and prints "Fizz" if the counter is divisible by 3. Prints "Buzz" if the counter is divisible by 5 and "FizzBuzz", ...
michael.zech's user avatar
  • 5,044
6 votes
1 answer
513 views

I want to write on failure to either STDOUT or STDERR a clean, simple error message for the user, without the (verbose) ...
Timur Shtatland's user avatar
3 votes
1 answer
79 views

The following is my solution to the Letter Blocks problem from Codejam 2022: https://codingcompetitions.withgoogle.com/codejam/round/0000000000877b42/0000000000afe6a1. Problem It is a rainy day, so ...
Panic's user avatar
  • 287
1 vote
1 answer
218 views

I am parsing a file that exists in either app/components/ui or in app/components. If the one in the first dir (...
jeffci's user avatar
  • 248
4 votes
2 answers
628 views

I'm creating a battleship game in Ruby. Let me explain how it works: The game is played on 5x5 grids (one per player). Players have 2 ships each to place on their grid. A small ship (3x1 side) and a ...
Edouard's user avatar
  • 41
4 votes
2 answers
173 views

I have done Tictactoe game in Ruby. It is my first Object Oriented project in Ruby. I would like to separate all program into a few classes such as Player Board and Game. I want to use more OOP best ...
theplaceofburak's user avatar
1 vote
1 answer
146 views

I've been adding stuff a bit "blindly" to my controller and currently everything is working as it should, but the controller is gotten very messy. I'm using the gem ...
Daniel's user avatar
  • 11
1 vote
1 answer
196 views

Would love some feedback on this simple API implementation with Ruby on Rails. Have I used proper naming conventions, readable/manageable code, optimal approaches, etc? As I'm still learning Ruby on ...
Jay's user avatar
  • 113
4 votes
1 answer
115 views

This very short piece of code is a migration in which a column name is changed to be more descriptive. It is part of a larger bioinformatics application written in RoR that parses the output of ...
Timur Shtatland's user avatar
1 vote
1 answer
214 views

I have been learning Ruby for 2 weeks. Today my bootcamp teacher taught Ruby Class and gave me homework. I coded simple library program. But I think the code is smelling bad. How can do better the ...
codescaptain's user avatar
-2 votes
2 answers
73 views

I wrote this method which I think is not effective as it doesn't respond to the missing method when I use the PORO Class. BalanceService ...
Afolabi Olaoluwa's user avatar
0 votes
1 answer
480 views

I started with the following module: ...
Steve K's user avatar
  • 135
3 votes
1 answer
248 views

When I need a singleton class in my Ruby code (for example, single logger for multiple classes) I usually use code like this: ...
Ivan Olshansky's user avatar
2 votes
2 answers
209 views

Hello everyone this is my first post here so please do critique my post if there's anything. I have made a program intended to pass a programming challenge on open.kattis.com, here. It should do as ...
ma22om's user avatar
  • 23
1 vote
2 answers
280 views

I'm a new programmer and I'm periodically going into the Intro To Algorithms CLRS textbook and trying to translate pseudocode into Ruby for skill practice. This is my implementation/translation of ...
Samuel Samuelson's user avatar
0 votes
0 answers
247 views

Let's say I have this array. items = [ { amount: 100, add: true }, { amount: 50, add: false }, { amount: 100, add: true } ] ...
dcangulo's user avatar
  • 191
4 votes
1 answer
124 views

Based on the sample variants, I need to get all combinations of all variants. In the example I have 3x3x2=18 variants. ...
dcangulo's user avatar
  • 191
1 vote
1 answer
107 views

I am writing a function that can be used in a ruby script that will match the parameter and values together so the script can use them in an intelligent way. The idea is if you were to run a script ...
jacksonecac's user avatar

1
2 3 4 5
33