Sha256: a32ea493849a091ae4775cdfdf2e90127c0046ce2a0c638e67c3e4f11a1304e6

Contents?: true

Size: 673 Bytes

Versions: 7

Compression:

Stored size: 673 Bytes

Contents

module Ardm
  module Deprecation
    def self.deprecations
      @deprecations ||= begin
                          at_exit { print_deprecations }
                          {}
                        end
    end

    def self.print_deprecations
      $stderr.puts 'Deprecations by count:'
      $stderr.puts deprecations.sort_by { |_,v| -v }.map { |message, count| "[%5d] %s" % [count, message] }
    end

    def self.warn(message)
      message = "DEPRECATED: #{message} at #{caller[2].sub(Rails.root.to_s,'')}"
      deprecations[message] ||= 0
      deprecations[message] += 1
      if deprecations[message] == 1
        $stderr.puts message
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 lib/ardm/deprecation.rb
ardm-0.4.0 lib/ardm/deprecation.rb
ardm-0.3.2 lib/ardm/deprecation.rb
ardm-0.3.1 lib/ardm/deprecation.rb
ardm-0.3.0 lib/ardm/deprecation.rb
ardm-0.2.7 lib/ardm/deprecation.rb
ardm-0.2.6 lib/ardm/deprecation.rb