Module: Qa::Authorities::Local
- Extended by:
- ActiveSupport::Autoload, AuthorityWithSubAuthority
- Defined in:
- lib/qa/authorities/local.rb,
lib/qa/authorities/local/registry.rb,
lib/qa/authorities/local/mysql_table_based_authority.rb
Defined Under Namespace
Classes: FileBasedAuthority, MysqlTableBasedAuthority, Registry, TableBasedAuthority
Class Attribute Summary collapse
-
.config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
- .load_config(file) ⇒ Object
-
.names ⇒ Object
Local sub-authorities are any YAML files in the subauthorities_path.
-
.register_subauthority(subauthority, class_name) ⇒ Object
Lookup and add the subauthority to the registry.
- .registry ⇒ Object
- .subauthorities ⇒ Object
-
.subauthorities_path ⇒ Object
Path to sub-authority files is either the full path to a directory or the path to a directory relative to the Rails application.
- .subauthority_for(subauthority) ⇒ Object
Methods included from AuthorityWithSubAuthority
new, subauthorities, subauthority_class, subauthority_for, validate_subauthority!
Class Attribute Details
.config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/qa/authorities/local.rb', line 11 def config @config end |
Class Method Details
.load_config(file) ⇒ Object
13 14 15 |
# File 'lib/qa/authorities/local.rb', line 13 def load_config(file) @config = YAML.load_file(file) end |
.names ⇒ Object
Local sub-authorities are any YAML files in the subauthorities_path
28 29 30 31 |
# File 'lib/qa/authorities/local.rb', line 28 def names raise Qa::ConfigDirectoryNotFound, "There's no directory at #{}. You must create it in order to use local authorities" unless Dir.exist? Dir.entries().map { |f| File.basename(f, ".yml") if f =~ /yml$/ }.compact end |
.register_subauthority(subauthority, class_name) ⇒ Object
Lookup and add the subauthority to the registry. This should only be used for sub-authorities, not stand-alone authorities such as Tgnlang, MESH, etc.
48 49 50 |
# File 'lib/qa/authorities/local.rb', line 48 def (, class_name) registry.add(, class_name) end |
.registry ⇒ Object
38 39 40 41 42 |
# File 'lib/qa/authorities/local.rb', line 38 def registry @registry ||= Registry.new do |reg| register_defaults(reg) end end |
.subauthorities ⇒ Object
52 53 54 |
# File 'lib/qa/authorities/local.rb', line 52 def registry.keys end |
.subauthorities_path ⇒ Object
Path to sub-authority files is either the full path to a directory or the path to a directory relative to the Rails application
19 20 21 22 23 24 25 |
# File 'lib/qa/authorities/local.rb', line 19 def if config[:local_path].starts_with?(File::Separator) config[:local_path] else Rails.root.join(config[:local_path]).to_s # TODO: Rails.root.join returns class Pathname, which may be ok. Added to_s because of failing regression test. end end |
.subauthority_for(subauthority) ⇒ Object
33 34 35 36 |
# File 'lib/qa/authorities/local.rb', line 33 def () () registry.instance_for() end |