Sha256: 9978ad36fbe41780952dac72b8fe97c53ef246dc99c8ba6fad2bd64a10875c4e

Contents?: true

Size: 637 Bytes

Versions: 17

Compression:

Stored size: 637 Bytes

Contents

module Mobility
  module ActiveModel
=begin

Backend resetter for ActiveModel models. Adds hook to reset backend when
+changes_applied+ or +clear_changes_information+ methods are called on model.

=end
    class BackendResetter < Mobility::BackendResetter

      # (see Mobility::BackendResetter#initialize)
      def initialize(attribute_names)
        super

        model_reset_method = @model_reset_method

        %i[changes_applied clear_changes_information].each do |method|
          define_method method do
            super()
            instance_eval(&model_reset_method)
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mobility-0.5.1 lib/mobility/active_model/backend_resetter.rb
mobility-0.5.0 lib/mobility/active_model/backend_resetter.rb
mobility-0.4.3 lib/mobility/active_model/backend_resetter.rb
mobility-0.4.2 lib/mobility/active_model/backend_resetter.rb
mobility-0.4.1 lib/mobility/active_model/backend_resetter.rb
mobility-0.4.0 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.6 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.5 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.4 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.3 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.2 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.1 lib/mobility/active_model/backend_resetter.rb
mobility-0.3.0 lib/mobility/active_model/backend_resetter.rb
mobility-0.2.3 lib/mobility/active_model/backend_resetter.rb
mobility-0.2.2 lib/mobility/active_model/backend_resetter.rb
mobility-0.2.1 lib/mobility/active_model/backend_resetter.rb
mobility-0.2.0 lib/mobility/active_model/backend_resetter.rb