Sha256: 4a6d9df48fa4b3cd7dcb33e9be83496eef489cf9ca98f5cfe70590d6ba390ac4

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

require 'ostruct'

require 'active_support'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/numeric/time'

require 'passive_record/version'
require 'passive_record/core/identifier'

require 'passive_record/arithmetic_helpers'
require 'passive_record/core/query'

require 'passive_record/class_inheritable_attrs'

require 'passive_record/associations'
require 'passive_record/hooks'

require 'passive_record/pretty_printing'

require 'passive_record/instance_methods'
require 'passive_record/class_methods'

module PassiveRecord
  def self.included(base)
    base.send :include, InstanceMethods
    base.send :include, ClassLevelInheritableAttributes
    base.send :include, PrettyPrinting

    base.class_eval do
      inheritable_attrs :hooks, :associations
    end

    base.extend(ClassMethods)

    model_classes << base
  end

  def self.model_classes
    @model_classes ||= []
  end

  def self.drop_all
    (model_classes + model_classes.flat_map(&:descendants)).uniq.each(&:destroy_all)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
passive_record-0.4.1 lib/passive_record.rb
passive_record-0.4.0 lib/passive_record.rb
passive_record-0.3.22 lib/passive_record.rb
passive_record-0.3.21 lib/passive_record.rb
passive_record-0.3.20 lib/passive_record.rb