Ruby is a multi-platform open-source dynamic object-oriented interpreted language created by Yukihiro Matsumoto (Matz) in 1993.
15
votes
1answer
613 views
Weekend Challenge: Ruby Poker Hand Evaluation
I'm late to this weekend challenge (sorry), but since it's all in good fun, I hope that's ok. I'm no poker player, though, so I may have completely overlooked something.
The ...
3
votes
1answer
137 views
Weekly flex calculator
This is one of the first RSpec tests I've written, and I'm not really sure what the best practices are etc.
My question basically is: what would you do differently? What is good? What is bad?
The ...
4
votes
2answers
499 views
How can I optimize this array.each in ruby?
I'm trying to optimize this bit of code and I thought I'd throw it out here to see if anyone has any ideas. I've been testing the performance using ...
12
votes
1answer
132 views
Multiplayer bowling in Ruby, with variable skill
This is a multiplayer bowling simulator in Ruby. It allows for variable skill levels, and produces weighted random results for each roll based on those skill settings. The methods are grouped in four ...
7
votes
1answer
110 views
Multiplayer bowling in Ruby (follow-up: injection, single responsibility)
This is a multiplayer bowling simulator in Ruby. It allows for variable skill levels, and produces weighted random results for each player's rolls based on those skill settings.
This is a complete ...
6
votes
3answers
308 views
Towers of Hanoi
I am just learning how to code in Ruby now with no prior experience. This is 3 towers of Hanoi where the user selects where to choose from and where to go with each disc, and not to have a bigger disc ...
6
votes
2answers
690 views
Higher lower game in Ruby
I finished the Ruby chapter in Seven Languages in Seven Weeks. It tries to make you familiar with the core concepts of several languages rather quickly. Dutifully I did all exercises, but most likely ...
5
votes
2answers
465 views
Spoj's 1st problem in tdd using Ruby
I am pretty new to TDD and is following problems on spoj.pl for practice. I need help with following code; it was my first attempt.
Problem: Your program is to use the brute-force approach in order ...
4
votes
1answer
110 views
Snakes and ladders random world builder
I wrote a random world generator for the classic Snakes and Ladders board game.
Snakes and Ladders is a dice game played over a grid, usually 10x10. You win by reaching the last square first. The ...
2
votes
1answer
274 views
Casino jackpot models
In the world of casinos, there are different types of games and jackpots. In this example, there are normal jackpots, multi-casino jackpots. I have a separate model for each of these. I need to ...
1
vote
1answer
45 views
Parsing GPS data
Recently I sent this code snippet as CV attachment and I got simple answer - this code smells and we employ another developer.
I'm new to RoR, so guys can you give me directions to refactor this code ...
21
votes
4answers
10k views
Unit-testing a controller in Ruby on Rails
I intend this to be a general question on writing an effective set of test cases for a controller action.
I include the following ingredients:
Ruby on Rails
RSpec: A testing framework. I considered ...
11
votes
4answers
920 views
Genetic algorithm for Clever Algorithms project
I wrote a bunch of Ruby code for a book project I've just finished. One criticism is that it is fine code but not very "ruby like". I agree my style was simplified for communication reasons, and ...
15
votes
5answers
2k views
8
votes
1answer
183 views
Spell a given number in English
I wrote a program that will take a number from 0 to 999,999,999,999 and spell out that number in English.
How could I improve the readability of my code?
...
7
votes
2answers
190 views
A Ruby sorting program for multiple criteria
This code review expands on an earlier one that deals with generating a football table from match data. This review deals with ordering said table based on several criteria.
Your ...
6
votes
1answer
143 views
Bowling scores in Ruby
A little while back, I wrote in a review of a Ruby bowling sim that I might try my hand at modelling the game myself, focussing on the funky "deferred scores" system. Since a2bfay, who posted the ...
6
votes
1answer
818 views
3
votes
3answers
2k views
Ruby multiples of 3 and 5 code challenge
I have implemented the first coding challenge on http://projecteuler.net/. I would love to get it reviewed by some expert rubyists! Thanks in advance :)
...
3
votes
1answer
270 views
Concurrent stack implementations in Ruby (relative performance of mutexes/CAS?)
This code is very simple, but it is intended as an experiment in the relative performance of mutexes/CAS on different platforms. The latest version can always be found at:
...
11
votes
1answer
359 views
Faster way to find maximum deviation?
So, it was a part of my coding challenge and the last one, but I failed because it failed to yield a result in two seconds for some of sample inputs (out of six samples, three passed but three failed ...
8
votes
1answer
178 views
Outputting a .txt file from a .csv file
I wrote this little script in PHP a bit ago. It takes a .csv file and outputs a .txt file with certain data arranged in a "psuedo-array" looking format. I recently started messing around with Ruby so ...
6
votes
3answers
544 views
Learning Ruby Caesar Cipher
I am trying to learn Ruby and made a simple Caesar cipher program and I was wondering if the following code follows the 'ruby way' or the way most ruby users would do it
...
6
votes
1answer
877 views
Custom grep in Ruby.
I finished the Ruby chapter in Seven Languages in Seven Weeks. It tries to make you familiar with the core concepts of several languages rather quickly. Dutifully I did all exercises, but most likely ...
5
votes
2answers
2k views
Caesar cipher in Ruby
I must implement a simple Caesar cipher class. Initializer takes two parameters - number of positions to shift the alphabet (integer) and the alphabet used (as string, not necessarily the standard ...
5
votes
2answers
147 views
Ruby method return values - how to be more Ruby-like?
How should I make this more Ruby-like or just "better"?
...
4
votes
1answer
73 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
3answers
590 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
178 views
CSV File Parser in Ruby
The following is my Ruby attempt at a (very) basic CSV file parser class, inspired by an exercise from the book Seven Languages in Seven Weeks. I'm a Ruby novice and will be grateful for any ...
3
votes
2answers
118 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 ...
3
votes
1answer
164 views
Bit Array in Ruby using integer as a storage
Ruby's Fixnum & Bignum can hold very large integers and automatically handle overflow. I decided to implement BitArray using an integer as storage. Please let me know what you think about code and ...
3
votes
2answers
361 views
Implementing Array#uniq in Ruby
I've implemented a working version of Array#uniq in Ruby to answer the question here: http://www.rubeque.com/problems/like-a-snowflake, but I'd like to see if there's ways to clean up my code or some ...
2
votes
1answer
36 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
1answer
52 views
Multiset implementation in Ruby
I am trying to implement the wikipedia definition of a MultiSet. Need feedback on implementation. Also I am not sure how to implement cartesian product.
...
2
votes
2answers
89 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
489 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
1answer
129 views
Needs code review for class implementation
could you please review the code for the implementation of the class (link: Ruby. Code review. Working alone on the code)
...
1
vote
1answer
128 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
162 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
81 views
Improving Watir::Browser for my needs
I want to:
use Watir::Browser methods without browser. instance prefix
expand abilities of ...