class ActiveValidation::BaseAdapter

Public Class Methods

abstract() click to toggle source

Abstract adapter should not be used directly

# File lib/active_validation/base_adapter.rb, line 32
def abstract
  true
end
adapter_name() click to toggle source
# File lib/active_validation/base_adapter.rb, line 41
def adapter_name
  plugin_name.sub(/_plugin\z/, "")
end
inherited(base) click to toggle source
Calls superclass method
# File lib/active_validation/base_adapter.rb, line 8
def inherited(base)
  # ruby 2.4 require this :send
  base.singleton_class.send(:attr_accessor, :abstract)

  # set default loading paths from the plugin root folder
  base.singleton_class.send(:attr_accessor, :loading_paths)
  base.loading_paths = []
  base.abstract = false
  ActiveValidation.config.orm_adapters_registry.register base.plugin_name, base
  super
end
loader() click to toggle source
# File lib/active_validation/base_adapter.rb, line 20
def loader
  return @loader if @loader

  @loader = Zeitwerk::Loader.new
  loading_paths.each do |loading_path|
    @loader.push_dir(Pathname.new(File.expand_path(__dir__)).join("orm_plugins", plugin_name, loading_path))
  end
  @loader.setup
  @loader
end
plugin_name() click to toggle source
# File lib/active_validation/base_adapter.rb, line 36
def plugin_name
  klass_name = name.split("::").detect { |c| c =~ /Plugin\z/ }
  klass_name ? klass_name.underscore : "base"
end
to_s() click to toggle source
# File lib/active_validation/base_adapter.rb, line 45
def to_s
  abstract ? "#{plugin_name} (abstract)" : plugin_name
end

Public Instance Methods

add_manifest(_manifest) click to toggle source

@abstract @param [Internal::Models::Manifest] :manifest @return [Internal::Models::Manifest] :manifest

# File lib/active_validation/base_adapter.rb, line 61
def add_manifest(_manifest)
  raise NotImplementedError, "abstract"
end
find_manifest(**_wheres) click to toggle source

@abstract Return the most recent Manifest, which meet the criteria

@param [Hash] Look up criteria @option manifest_hash [String] :name Human readable name, by default build with selected

formatter for current manifest

@option manifest_hash [String, Class] :base_klass (base_klass) Base klass for the Manifest @option manifest_hash [String, Symbol, Integer, Values::Version] :version (:current) Version

of the current manifest

@example find_manifest({ base_klass: 'Bar' })

@see Internal::Models::Manifest

@return [Internal::Models::Manifest]

# File lib/active_validation/base_adapter.rb, line 80
def find_manifest(**_wheres)
  raise NotImplementedError, "abstract"
end
find_manifests(**_wheres) click to toggle source

@abstract Return the most recent Manifests, which meet the criteria

@param [Hash] Look up criteria @option manifest_hash [String] :name Human readable name, by default build with selected

formatter for current manifest

@option manifest_hash [String, Class] :base_klass (base_klass) Base klass for the Manifest @option manifest_hash [String, Symbol, Integer, Values::Version] :version (:current) Version

of the current manifest

@example find_manifests({ base_klass: 'Bar' })

@see Internal::Models::Manifest

@return [Array<Internal::Models::Manifest>]

# File lib/active_validation/base_adapter.rb, line 99
def find_manifests(**_wheres)
  raise NotImplementedError, "abstract"
end
setup() click to toggle source

@abstract should setup self.class.initialised to true after loading all dependencies

# File lib/active_validation/base_adapter.rb, line 54
def setup
  raise NotImplementedError, "abstract"
end