🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

Flay is Coming

Published 2008-09-16 @ 23:56

Tagged ruby

Imagine having a tool that points out these two methods as potential duplicates and therefore candidates for refactoring:

  def save(path)
    File.open path, 'wb' do |f|
      f.write to_blob
    end
  end

versus:

  def write(file); File.open(file, 'wb') { |f| f.write to_s }; end

Are they different? Sure! One calls #to_s and the other calls #to_blob. Is that enough difference to not consider them for refactoring? No, not in the slightest…

Flay… it is coming…