Sha256: 35f86f1eab7aa50ff12c0fbde0913ef03c65c30471fd9c06a33bfe5f23f54302

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

# -*- encoding : utf-8 -*-
module Pacto
  # Included this module so that Pacto::Resettable.reset_all will call your class/module's self.reset! method.
  module Resettable
    def self.resettables
      @resettables ||= []
    end

    def self.extended(base)
      resettables << base
    end

    def self.included(base)
      resettables << base
    end

    def self.reset_all
      resettables.each(&:reset!)
      true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pacto-0.4.0.rc3 lib/pacto/resettable.rb
pacto-0.4.0.rc2 lib/pacto/resettable.rb
pacto-0.4.0.rc1 lib/pacto/resettable.rb