Sha256: 147d548fd82ff23ae003a0556a39c5a6e30603eeb3b2bd568cbe040f6d3bdb0d

Contents?: true

Size: 476 Bytes

Versions: 5

Compression:

Stored size: 476 Bytes

Contents

module DatabaseCleaner
  def deprecate message
    method = caller.first[/\d+:in `(.*)'$/, 1].to_sym
    @@deprecator ||= Deprecator.new
    @@deprecator.deprecate method, message
  end
  module_function :deprecate

  class Deprecator
    def initialize
      @methods_already_warned = {}
    end

    def deprecate method, message
      return if @methods_already_warned.key?(method)
      $stderr.puts message
      @methods_already_warned[method] = true
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
database_cleaner-1.8.3 lib/database_cleaner/deprecation.rb
database_cleaner-1.8.2 lib/database_cleaner/deprecation.rb
database_cleaner-1.8.1 lib/database_cleaner/deprecation.rb
database_cleaner-1.8.0 lib/database_cleaner/deprecation.rb
database_cleaner-1.8.0.beta lib/database_cleaner/deprecation.rb