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
5
votes
1answer
237 views

Sort a scrambled itinerary (Google apac test problem)

This is my first time writing ruby - and I was mainly hoping to get some feedback and stylistic pointers. The algorithm is pretty straight-forward, since Google guarantees airports aren't repeated I ...
5
votes
1answer
275 views

Next, greater permutation of digits of a number

Was looking at this question (which I initially misunderstood completely), to which Peter Taylor posted a good answer outlining a much better algorithm. For kicks, I implemented it in Ruby, but I ...
5
votes
2answers
1k views

Simple TicTacToe game with AI in Ruby

What changes do you recommend from the perspective of structure, logic, etc? ...
4
votes
2answers
139 views

Boggle board solver in Ruby

The following is my attempt at creating a Boggle board solver in Ruby. It's not especially fast. I would love to have input on how the solution can either be sped up, or whether a different algorithm ...
4
votes
1answer
174 views

Countdown AppIndicator

I've decided to translate an old Unity AppIndicator I had written in C to Ruby, so I can practice coding with it (got a little bored with the completely beginner lessons I've been following, which I'...
4
votes
2answers
1k views

Lowest Common Multiple of 1 to n in Ruby

Project Euler problem 5 asks: What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? I'm learning Ruby by going through Project Euler problems, and ...
4
votes
2answers
324 views

Ruby Interrupted Bubble Sort

Working through CodeEval's Interrupted Bubble Sort, I have a working algorithm, but there's a speed issue. I'm trying to do this with Ruby and I keep getting an error that it's timing out after 10 ...
4
votes
1answer
111 views

Small football table builder in Ruby

Please review this small program I wrote to create a World Cup Group Table. You feed the program match info, and it builds a table based on that info. ...
4
votes
1answer
67 views

Unlocking spreadsheet files quickly

I've created a program for my job that unlocks spreadsheet files quickly and efficiently. What we use to have to do before this program is we'd have to go into the system, search for the file, kill ...
4
votes
1answer
81 views

Command line based email generation tool

Unfortunately due to my job I will have to leave out some of the information that is created by this generator, however I will be replacing it with another string of information. I have created an ...
4
votes
2answers
872 views

Simple calculator using eval

The following code is for a calculator made in ruby, I find that this way saves much time than having to build this calculator from scratch, especially that I want it to support BEMDAS operations. ...
4
votes
3answers
1k views

Menu-based Caesar Cipher with encryption and decryption

I am about to start a very large project in Ruby. To get myself in the Ruby mindset I have been doing all of my homework and other side work in Ruby. I am hoping that some of you who know Ruby very ...
3
votes
1answer
49 views

(Ruby version) Rotate linked list to the right by k places

I saw this question (javascript - rotate linked list to the right by k places) the other day and I tried implementing it in Ruby in a totally different way. Here's the code (I also created a REPL if ...
3
votes
0answers
108 views

Codingame: Great Escape bot in Ruby - Follow-up

This is a follow-up to Codingame: Great Escape bot in Ruby. As mentioned there, my first reasonably sized Ruby project is a bot for CodinGame's Great Escape contest (here is a sample gameplay video). ...
3
votes
1answer
280 views

Ruby program to simulate a game of Narcotic Solitaire

In the game of Narcotic Solitaire, played with a standard 52-card deck, the player deals a row of four cards onto the table, from left to right. If all four cards are of the same value, they are ...
3
votes
3answers
193 views

Calculating change based on input

I decided to make a program that calculates change, based on an input. My code is extremely long, and I would like to know how I can fix this. ...
3
votes
1answer
754 views

Bit Array in Ruby using integer as a storage

Ruby's Fixnum and Bignum can hold very large integers and automatically handle overflow. I decided to implement ...
3
votes
2answers
718 views

Print multiplication tables

Write a function that given a max argument will print a nicely aligned multiplication tables, for example, if max = 8 ...
3
votes
2answers
1k views

Bubble sort implementation with tests

For practice I tried implementing a bubble sort algorithm in Ruby. I'm especially interested in creating clean DRY and KISS code and keeping things readable, but efficient. Any hints to improve things ...
3
votes
2answers
507 views

Snakes and Ladders random world generator second implementation

The following is an implementation of a random world generator for the classic Snakes and Ladders game. This is a follow up to this question, where I reviewed my own original implementation. I am ...
2
votes
1answer
91 views

Class for median filter

I'm new to ruby, later I asked about ways to refactor code (Parsing GPS data), one man gave me direction, so I made class for Median filter and it will be great to read review for my work. What guys ...
2
votes
0answers
121 views

Ruby - Asteroids Remake

After some feedback on my last Ruby Code I decided to start another one with two big concerns in mind: Trying to adequate my coding to the OOP paradigm Trying to follow the Ruby Style-Guideliness I ...
2
votes
2answers
132 views

Transfer the format of an old string to a new string

First, I've extended the String class to detect uppercase and lowercase characters: ...
2
votes
1answer
826 views

define_method vs method_missing and CodeClimate scores

This may be a better fit for another board, but here goes: I've made a very simple gem that acts as a days-of-the-week bitmask. To be hip, I registered it on CodeClimate, where it's currently scoring ...
2
votes
2answers
81 views

A sequence of mistakes

This question is part of a series solving the Rosalind challenges. For the previous question in this series, see The Genetic Code. The repository with all my up-to-date solutions so far can be found ...
2
votes
1answer
161 views

Needs code review for class implementation

could you please review the code for the implementation of the class (link: General review of Robot class) ...
2
votes
1answer
269 views

Multiset implementation in Ruby

I am trying to implement the Wikipedia definition of a MultiSet and need feedback on the implementation. ...
1
vote
1answer
540 views

Update subscription

First, some background. I have a Payment model that has_many :subscriptions. When a user pays (creates a new payment), I have an ...
1
vote
0answers
556 views

Unit-testing authorization policies in Rails with RSpec

The following specs test the authorization setup of the Post resource in a Rails 4.2 application. The Pundit gem is used for authorization but I believe the specs ...
1
vote
1answer
38 views

Destroy script for provisioning

Script intended to remove Vault & Consul setup before run re-provision them on server. This is my first Ruby script, so will be perfect to see my mistakes here. ...
1
vote
1answer
197 views

Implementing plugins in my Ruby social aggregator app

Some time ago I started with a small Ruby project. I call it social_aggregator. This software aggregates information from different networks to one xml-stream, ...
1
vote
2answers
381 views

General review of Robot class

I'm working alone on my code, trying to learn Ruby as I go. Class Robot is supposed to be instantiated with the position on a map, and whether it is facing toward ...
0
votes
1answer
47 views

Unlocking spreadsheet files quickly - follow-up

I recently posted a program I made to unlock spreadsheet files( see also ), I've taken all of your advice and made it more Ruby like, it has no shell commands in it, and uses ...
0
votes
1answer
166 views

Improving Watir::Browser for my needs

I want to: use Watir::Browser methods without browser. instance prefix expand abilities of ...