Sha256: fd65b634f309c7e26440cb7df02e70fe2db3a26f0e76facd675f2a990591b6a3
Contents?: true
Size: 786 Bytes
Versions: 8
Compression:
Stored size: 786 Bytes
Contents
require 'digest/sha1' module OverridesTracker class Util class << self def method_hash method begin { :sha => method_sha(method), :location => method.source_location, :body => outdented_method_body(method), } rescue { :sha => method.hash, :location => nil, :body => nil, } end end def outdented_method_body method body = method.source indent = body.match(/^\W+/).to_s body.lines.map{|l| l.sub(indent, '')}.join end def method_sha method Digest::SHA1.hexdigest(method.source.gsub(/\s+/, ' ')) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems