Skip to content

Instantly share code, notes, and snippets.

@michaelfeathers
Created April 3, 2015 02:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelfeathers/1e2934ebb95560cddc3b to your computer and use it in GitHub Desktop.
Save michaelfeathers/1e2934ebb95560cddc3b to your computer and use it in GitHub Desktop.
return a string that represents increases, decreases, and stable changes in a method's length
# :: [event] -> String -> String
def method_delta_line es, method_name
es.select {|e| e.method_name == method_name }
.map(&:method_length)
.each_cons(2)
.map {|c,n| ["^","v","-"][(c <=> n) + 1] }
.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment