Sha256: 65fa1bc5b9bd79767c2f323ef06d07afac7f5d0606e2e815552fbae54d428fbf

Contents?: true

Size: 1.79 KB

Versions: 102

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

102 entries across 102 versions & 5 rubygems

Version Path
test_track_rails_client-0.9.10 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.9 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.8 vendor/gems/her/lib/her/model/deprecated_methods.rb
her-0.8.2 lib/her/model/deprecated_methods.rb
her5-0.8.2 lib/her/model/deprecated_methods.rb
her5-0.8.1 lib/her/model/deprecated_methods.rb
castle-her-1.0.1 lib/castle-her/model/deprecated_methods.rb
her-0.8.1 lib/her/model/deprecated_methods.rb
her-0.7.6 lib/her/model/deprecated_methods.rb
her-0.7.5 lib/her/model/deprecated_methods.rb
her-0.7.4 lib/her/model/deprecated_methods.rb
herr-0.7.3 lib/her/model/deprecated_methods.rb
her-0.7.3 lib/her/model/deprecated_methods.rb
her-0.7.2 lib/her/model/deprecated_methods.rb
her-0.7.1 lib/her/model/deprecated_methods.rb
her-0.7 lib/her/model/deprecated_methods.rb
her-0.6.8 lib/her/model/deprecated_methods.rb
her-0.6.7 lib/her/model/deprecated_methods.rb
her-0.6.6 lib/her/model/deprecated_methods.rb
her-0.6.5 lib/her/model/deprecated_methods.rb