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-1.3.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-1.2.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
her-0.9.0 lib/her/model/deprecated_methods.rb
test_track_rails_client-1.1.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-1.0.0 vendor/gems/her/lib/her/model/deprecated_methods.rb
her-0.8.6 lib/her/model/deprecated_methods.rb
her-0.8.5 lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.20 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.19 vendor/gems/her/lib/her/model/deprecated_methods.rb
her-0.8.4 lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.18 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.17 vendor/gems/her/lib/her/model/deprecated_methods.rb
her-0.8.3 lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.16 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.15 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.14 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.13 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.12 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.11 vendor/gems/her/lib/her/model/deprecated_methods.rb
test_track_rails_client-0.9.10 vendor/gems/her/lib/her/model/deprecated_methods.rb