Skip to content

Instantly share code, notes, and snippets.

@mmower
Created September 22, 2009 01:07
Show Gist options
  • Save mmower/190679 to your computer and use it in GitHub Desktop.
Save mmower/190679 to your computer and use it in GitHub Desktop.
class Album
def info(val1, val2, val3)
val1 + ", " + val2 + ", " + "#{val3}"
end
end
# It's not at all clear what is going on here. First, I can make the assumption
# that val1 is an album name & val2 is the band. But val3? No clue. How about
def info( album, band, whatever_this_is )
"#{album}, #{band}, #{whatever_this_is}"
end
# instead? Note that the use of a single string with multiple interpolations is
# more idiomatically ruby than using string addition.
require 'jukebox'
describe Album do
it "should contain band information" do
alb = Album.new
alb.info("Wanna Meet The Scruffs", "The Scruffs", 250).should == "Wanna Meet The Scruffs, The Scruffs, 250"
end
end
# When you say you are questioning the content of your method it's not immediately clear
# to me what you are asking me to comment on. Can you put it another way?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment