1
vote
4answers
144 views

Double conditional : Cleaner way to write a set of conditionals

Is there a cleaner way to write: def b_fname if mdes_version_is_after?(3.0) result = c_fname else result = response_for("#{birth_baby_name_prefix}.BABY_FNAME") end if ...
1
vote
2answers
123 views

Ruby implementation of Conway's Game of Life

I'm just starting with Ruby and decided to do two different implementations of Conway's Game of Life. In this first one I'm not using cells as a separate class and instead just track everything as a ...
2
votes
1answer
128 views

Which of these implementations is considered cleaner?

I've got a simple sinatra webapp that pulls data from Pinboard's RSS api, parses the info, and re-displays it. There are 4 tasks I need to perform with the data: I need to remove all instances of a ...
2
votes
1answer
107 views

Is this good Ruby?

This is the "codebreaker" game in Ruby, tell me what I can make better! #!/usr/bin/env ruby class Sequence attr_accessor :guess, :code def initialize puts "Type the difficulty level you ...
5
votes
1answer
395 views

Is this Spaghetti code?

I recently wrote my first webapp and here is the code. I want to make it better, but I'm not exactly sure how. I believe the first place I should start is with the structure of it. Is this spaghetti ...