Sha256: 8526b799dacd02b246dad5e479bfac0f6f38f3d7f8311a2fdd220efe35027985

Contents?: true

Size: 456 Bytes

Versions: 2

Compression:

Stored size: 456 Bytes

Contents

module MemoryModel
  class Base
    module Actions
      module ClassMethods

        def create(attributes={})
          new(attributes).tap(&:save)
        end

        def create!(attributes={})
          new(attributes).tap(&:save!)
        end

        def delete_all
          count.tap do
            self.collection.clear
          end
        end

        def destroy_all
          self.all.each(&:destroy)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
memory_model-1.0.0 lib/memory_model/base/actions/class_methods.rb
memory_model-0.1.0 lib/memory_model/base/actions/class_methods.rb