The calendar is gone.
Click here to view posts


Ruby code that makes me sad
I found some Ruby code that makes me sad.
class String
  def self.empty
    ''
  end
end

String.empty
This makes me wonder if the person who wrote this thought that String.new was filled with random bytes.
I also found this..
class Object 
  def not_nil?
    !self.nil?
  end
end

"string".not_nil?
I dont even think that this works for syntax sugar. Lets look at a few statements statements side by side and see how this concept looks.
if x
 puts "we have x"
end

if x.not_nil?
 puts "we have x"
end

# even better
unless x
 puts "we do not have x"
end

unless x.not_nil?
 puts "We do not have x"
end
Give people sharp scissors and the will run with them. I really think the saying is give someone enough rope and they will hang themselves.