Sha256: 65fa1bc5b9bd79767c2f323ef06d07afac7f5d0606e2e815552fbae54d428fbf

Contents?: true

Size: 1.79 KB

Versions: 101

Compression:

Stored size: 1.79 KB

Contents

module Her
  module Model
    # @private
    module DeprecatedMethods
      extend ActiveSupport::Concern

      def self.deprecate!(old, new, object, *args)
        line = begin
          raise StandardError
        rescue StandardError => e
          e.backtrace[2]
        end

        warn "#{line} - The `#{old}` method is deprecated and may be removed soon. Please update your code with `#{new}` instead."
        object.send(new, *args)
      end

      def data(*args)
        Her::Model::DeprecatedMethods.deprecate! :data, :attributes, self, *args
      end

      def data=(*args)
        Her::Model::DeprecatedMethods.deprecate! :data=, :attributes=, self, *args
      end

      def update_attributes(*args)
        Her::Model::DeprecatedMethods.deprecate! :update_attributes, :assign_attributes, self, *args
      end

      def assign_data(*args)
        Her::Model::DeprecatedMethods.deprecate! :assign_data, :assign_attributes, self, *args
      end

      def has_data?(*args)
        Her::Model::DeprecatedMethods.deprecate! :has_data?, :has_attribute?, self, *args
      end

      def get_data(*args)
        Her::Model::DeprecatedMethods.deprecate! :get_data, :get_attribute, self, *args
      end

      module ClassMethods
        def has_relationship?(*args)
          Her::Model::DeprecatedMethods.deprecate! :has_relationship?, :has_association?, self, *args
        end

        def get_relationship(*args)
          Her::Model::DeprecatedMethods.deprecate! :get_relationship, :get_association, self, *args
        end

        def relationships(*args)
          Her::Model::DeprecatedMethods.deprecate! :relationships, :associations, self, *args
        end

        def her_api(*args)
          Her::Model::DeprecatedMethods.deprecate! :her_api, :use_api, self, *args
        end
      end
    end
  end
end

Version data entries

101 entries across 101 versions & 5 rubygems

Version Path
test_track_rails_client-7.1.2 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-7.1.1 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-7.0.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-6.0.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-5.0.1 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-5.0.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
her-1.1.1 lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.2 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.1 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.rc3 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.rc2 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha35 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha34 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha33 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha32 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha31 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha30 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha29 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-4.0.0.alpha28 vendor/gems/her/lib/her/model/deprecated_methods.rb