Sha256: 0c1c662f327ecc7e6aa955a90a6908d7b20a6ac6047747e3a5dc940c1de66372

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'active_model'
require 'active_record'
require 'active_support/core_ext'

module NinjaModel
  extend ActiveSupport::Autoload

  class NinjaModelError < StandardError; end

  class << self
    attr_accessor :logger

    def set_logger(logger)
      ::NinjaModel.logger = logger
    end

    def ninja_model?(symbol)
      #klass = symbol.to_s.camelize
      #klass = klass.singularize
      #klass = symbol.constantize
      symbol.ancestors.include?(NinjaModel::Base)
    end

    def configuration
      @config ||= ActiveSupport::OrderedOptions.new
    end
  end

  autoload :Attribute
  autoload :AttributeMethods
  autoload :Associations
  autoload :Adapters
  autoload :Base
  autoload :Callbacks
  autoload :Identity
  autoload :Marshalling
  autoload :Persistence
  autoload :Predicate
  autoload :Reflection
  autoload :Relation
  autoload :Validation

  ActiveSupport.on_load(:active_record) do
    require 'ninja_model/rails_ext/active_record'
    include ActiveRecord::NinjaModelExtensions::ReflectionExt
  end
end

if defined?(Rails)
  require 'ninja_model/railtie'
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ninja-model-1.0.5 lib/ninja_model.rb
ninja-model-1.0.4 lib/ninja_model.rb
ninja-model-1.0.3 lib/ninja_model.rb
ninja-model-1.0.2 lib/ninja_model.rb
ninja-model-1.0.1 lib/ninja_model.rb
ninja-model-1.0.0 lib/ninja_model.rb