Class: Humidifier::Loader::StructureContainer
- Inherits:
-
Object
- Object
- Humidifier::Loader::StructureContainer
- Defined in:
- lib/humidifier/loader.rb
Overview
Handles searching the PropertyTypes specifications for a specific resource type
Instance Attribute Summary collapse
-
#structs ⇒ Object
readonly
Returns the value of attribute structs.
Instance Method Summary collapse
-
#initialize(structs) ⇒ StructureContainer
constructor
A new instance of StructureContainer.
-
#search(key) ⇒ Object
find the substructures necessary for the given resource key.
Constructor Details
#initialize(structs) ⇒ StructureContainer
Returns a new instance of StructureContainer.
21 22 23 |
# File 'lib/humidifier/loader.rb', line 21 def initialize(structs) @structs = structs end |
Instance Attribute Details
#structs ⇒ Object (readonly)
Returns the value of attribute structs.
19 20 21 |
# File 'lib/humidifier/loader.rb', line 19 def structs @structs end |
Instance Method Details
#search(key) ⇒ Object
find the substructures necessary for the given resource key
26 27 28 29 |
# File 'lib/humidifier/loader.rb', line 26 def search(key) results = structs.keys.grep(/#{key}/) Hash[results.map { |result| result.gsub("#{key}.", '') }.zip(structs.values_at(*results))].merge(global) end |