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_api-0.8.8 lib/github_api/deprecation.rb
github_api-0.8.7 lib/github_api/deprecation.rb
github_api-0.8.6 lib/github_api/deprecation.rb
github_api-0.8.5 lib/github_api/deprecation.rb
github_api-0.8.4 lib/github_api/deprecation.rb
github_api-0.8.3 lib/github_api/deprecation.rb
github_api-0.8.2 lib/github_api/deprecation.rb
github_api-0.8.1 lib/github_api/deprecation.rb
github_api-0.8.0 lib/github_api/deprecation.rb
github_api-0.7.2 lib/github_api/deprecation.rb
github_api-0.7.1 lib/github_api/deprecation.rb
github_api-0.7.0 lib/github_api/deprecation.rb
github_api-0.6.5 lib/github_api/deprecation.rb
github_api-0.6.4 lib/github_api/deprecation.rb
github_api-0.6.3 lib/github_api/deprecation.rb
github_api-0.6.2 lib/github_api/deprecation.rb
github_api-0.6.1 lib/github_api/deprecation.rb
github_api-0.6.0 lib/github_api/deprecation.rb
github_api-0.5.4 lib/github_api/deprecation.rb
github_api-0.5.3 lib/github_api/deprecation.rb