Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
4
votes
1answer
419 views

Autodetecting monitors in XFCE

I got sick of manually xrandering things on my computers (especially since I always just sequence monitors from left to right and set each at the highest resolution) so I wrote this: ...
1
vote
4answers
952 views
27
votes
4answers
14k 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 ...
8
votes
1answer
238 views

RubyGem for Enums

A little background first. I've been working on a fairly large Rails application which quickly grew into a breeding ground for "smelly" code. One antipattern we were using a lot was storing objects ...
8
votes
1answer
22k views

Filtering (search) a model with multiple params in hash

This function in my Profile model receive a hash from a search form and should filter the table depending on those values. I guess there is something like a pattern ...
23
votes
2answers
3k views

Ruby Koans' Greed Task

Having coded in Java and C# for quite some years, I'm currently learning Ruby. I'm working my way through the Ruby Koans tutorial. At some point, you are to implement a method that calculates the game-...
17
votes
4answers
1k 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 ...
3
votes
5answers
12k views

Avoiding null in variable assignment

I want to get empty string or the string value of the object Which code you will use and why? value = object.to_s or this ...
24
votes
5answers
23k views

Use of a regex stored inside a YAML file

I installed settingslogic and in the configuration file I put the regex for the email as follows: ...
7
votes
1answer
1k views

Object cache storage for Rails

I want to have fast cache in which I want to keep all my nomenclature data. I don't want to go with Memcached because I have to do serialize/de-serialize on each object which is slow. So I choose to ...