Sha256: 42b44f0f661d5c30f5df36db9cd55621b7d67d439d4c7f28945b787da109e203

Contents?: true

Size: 654 Bytes

Versions: 56

Compression:

Stored size: 654 Bytes

Contents

module Avo
  module Concerns
    module CanReplaceItems
      extend ActiveSupport::Concern

      included do
        class_attribute :temporary_items
      end

      class_methods do
        def with_temporary_items(&block)
          # back-up the previous items
          self.temporary_items = block
        end

        def restore_items_from_backup
          self.temporary_items = nil
        end

        def with_new_items(&block)
          self.items_holder = Avo::Resources::Items::Holder.new

          instance_eval(&block)
        end
      end

      def with_new_items(&)
        self.class.with_new_items(&)
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
avo-3.16.4 lib/avo/concerns/can_replace_items.rb
avo-3.16.3 lib/avo/concerns/can_replace_items.rb
avo-3.16.2 lib/avo/concerns/can_replace_items.rb
avo-3.16.1 lib/avo/concerns/can_replace_items.rb
avo-3.16.0 lib/avo/concerns/can_replace_items.rb
avo-3.15.7 lib/avo/concerns/can_replace_items.rb
avo-3.15.6 lib/avo/concerns/can_replace_items.rb
avo-3.15.5 lib/avo/concerns/can_replace_items.rb
avo-3.15.4 lib/avo/concerns/can_replace_items.rb
avo-3.15.3 lib/avo/concerns/can_replace_items.rb
avo-3.15.2 lib/avo/concerns/can_replace_items.rb
avo-3.15.1 lib/avo/concerns/can_replace_items.rb
avo-3.15.0 lib/avo/concerns/can_replace_items.rb
avo-3.14.5 lib/avo/concerns/can_replace_items.rb
avo-3.14.4 lib/avo/concerns/can_replace_items.rb
avo-3.14.3 lib/avo/concerns/can_replace_items.rb
avo-3.14.2 lib/avo/concerns/can_replace_items.rb
avo-3.14.1 lib/avo/concerns/can_replace_items.rb
avo-3.14.0 lib/avo/concerns/can_replace_items.rb
avo-3.13.7 lib/avo/concerns/can_replace_items.rb