Sha256: dd5ed55f5149a138554a3619177aa3b86b1abc2f6b3a0bd92e6ab839d5d49c6d

Contents?: true

Size: 774 Bytes

Versions: 73

Compression:

Stored size: 774 Bytes

Contents

# encoding: utf-8

module Github

  DEPRECATION_PREFIX = "[GithubAPI] Deprecation warning:"

  class << self

    attr_writer :deprecation_tracker

    def deprecation_tracker
      @deprecation_tracker ||= []
    end

    # Displays deprecation message to the user.
    # Each message is printed once.
    def deprecate(method, alternate_method=nil)
      return if deprecation_tracker.include? method
      deprecation_tracker << method

      message = <<-NOTICE
#{DEPRECATION_PREFIX}

* #{method} is deprecated.
NOTICE
      if alternate_method
        message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
      end
      warn_deprecation(message)
    end

    def warn_deprecation(message)
      send :warn, message
    end
  end

end # Github

Version data entries

73 entries across 73 versions & 3 rubygems

Version Path
github_api2-1.0.1 lib/github_api2/deprecation.rb
github_api2-1.0.0 lib/github_api2/deprecation.rb
github_api-0.19.0 lib/github_api/deprecation.rb
lingfennan-github_api-0.18.2 lib/github_api/deprecation.rb
github_api-0.18.2 lib/github_api/deprecation.rb
github_api-0.18.1 lib/github_api/deprecation.rb
github_api-0.17.0 lib/github_api/deprecation.rb
github_api-0.16.0 lib/github_api/deprecation.rb
github_api-0.15.0 lib/github_api/deprecation.rb
github_api-0.14.5 lib/github_api/deprecation.rb
github_api-0.14.4 lib/github_api/deprecation.rb
github_api-0.14.3 lib/github_api/deprecation.rb
github_api-0.14.2 lib/github_api/deprecation.rb
github_api-0.14.1 lib/github_api/deprecation.rb
github_api-0.14.0 lib/github_api/deprecation.rb
github_api-0.13.1 lib/github_api/deprecation.rb
github_api-0.13.0 lib/github_api/deprecation.rb
github_api-0.12.4 lib/github_api/deprecation.rb
github_api-0.12.3 lib/github_api/deprecation.rb
github_api-0.12.2 lib/github_api/deprecation.rb