Module: Foobara::Namespace::LookupMode
- Defined in:
- foobara-0.6.1/projects/typesystem/projects/namespace/src/namespace/lookup_mode.rb
Overview
TODO: need to define these better/more intuitively use-cases
- general: just general lookup. find it wherever the heck it might be children: y parent: y dependent: y
- direct: only this namespace. we want to know what this namespace directly owns children: n parent: n dependent: n
- strict children: n parent: y dependent: n
- absolute children: y parent: n dependent: y
- absolute_single_namespace children: y parent: n dependent: n
- children_only (internal use... absolute and absolute_single_namespace jump to top, children only does not) children: y parent: n dependent: n TODO: don't we have an enumerated class/project for this? Maybe use bitmasks for the above 3 places to look instead of a list of 7 lookup types? (There should be 8...)
Constant Summary collapse
- GENERAL =
:general- RELAXED =
Relaxed will allow you to find registered entries without prefixes as long as it's not ambiguous So if there is a SomeOrg::SomeDomain::SomeCommand
GlobalOrganization.foobara_lookup(:SomeCommand)will return nil butGlobalOrganization.foobara_lookup(:SomeCommand, mode: Foobara::Namespace::LookupMode::RELAXED)will return SomeOrg::SomeDomain::SomeCommand even though we didn't specify the necessary prefixes to navigate to it. :relaxed- DIRECT =
:direct- STRICT =
:strict- ABSOLUTE =
:absolute- ABSOLUTE_SINGLE_NAMESPACE =
:absolute_single_namespace- CHILDREN_ONLY =
:children_only- ALL =
[GENERAL, RELAXED, DIRECT, STRICT, ABSOLUTE, ABSOLUTE_SINGLE_NAMESPACE, CHILDREN_ONLY].freeze
Class Method Summary collapse
Class Method Details
.validate!(mode) ⇒ Object
49 50 51 52 53 54 55 |
# File 'projects/typesystem/projects/namespace/src/namespace/lookup_mode.rb', line 49 def validate!(mode) unless ALL.include?(mode) # simplecov:disable raise ArgumentError, "Expected #{mode} to be one of #{ALL.map(&:inspect).join(",")}" # simplecov:enable end end |