Class: Infusible::DependencyMap
- Inherits:
-
Object
- Object
- Infusible::DependencyMap
- Defined in:
- lib/infusible/dependency_map.rb
Overview
Sanitizes and resolves dependencies for use.
Constant Summary collapse
- PATTERNS =
{key: /([a-z_][a-zA-Z_0-9]*)$/, valid: /^[\w.]+$/}.freeze
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
-
#initialize(*configuration, patterns: PATTERNS) ⇒ DependencyMap
constructor
A new instance of DependencyMap.
- #to_h ⇒ Object
Constructor Details
#initialize(*configuration, patterns: PATTERNS) ⇒ DependencyMap
Returns a new instance of DependencyMap.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/infusible/dependency_map.rb', line 10 def initialize *configuration, patterns: PATTERNS @patterns = patterns @collection = {} aliases = configuration.last.is_a?(Hash) ? configuration.pop : {} configuration.each { |identifier| add to_key(identifier), identifier } aliases.each { |key, identifier| add key, identifier } @keys = collection.keys.freeze end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
8 9 10 |
# File 'lib/infusible/dependency_map.rb', line 8 def keys @keys end |
Instance Method Details
#to_h ⇒ Object
22 |
# File 'lib/infusible/dependency_map.rb', line 22 def to_h = collection |