Sha256: 106627e75925420bcc92041ca9251c8575c02ce3183c36cf46888331437849dc

Contents?: true

Size: 580 Bytes

Versions: 17

Compression:

Stored size: 580 Bytes

Contents

module Mobility
  module Sequel
=begin

Backend resetter for Sequel models. Triggers backend reset when +refresh+
method is called.

=end
    class BackendResetter < Mobility::BackendResetter

      # @param [Class] model_class Class of model to which backend resetter will be applied
      def included(model_class)
        model_reset_method = @model_reset_method

        mod = Module.new do
          define_method :refresh do
            super().tap { instance_eval(&model_reset_method) }
          end
        end
        model_class.include mod
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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