Sha256: 031914a3d36e0c37969867d94ff0e10cdaacaddab38caf84bd7cc681b9a05e84

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module Rpush
  module Deprecatable
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def deprecated(method_name, version, msg=nil)
        instance_eval do
          alias_method "#{method_name}_without_warning", method_name
        end
        warning = "#{method_name} is deprecated and will be removed from Rpush #{version}."
        warning << " #{msg}" if msg
        class_eval(<<-RUBY, __FILE__, __LINE__)
          def #{method_name}(*args, &blk)
            Rpush::Deprecation.warn(#{warning.inspect})
            #{method_name}_without_warning(*args, &blk)
          end
        RUBY
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpush-1.0.0-java lib/rpush/deprecatable.rb
rpush-1.0.0 lib/rpush/deprecatable.rb