Class: Humidifier::Loader::PropertyTypes
- Inherits:
-
Object
- Object
- Humidifier::Loader::PropertyTypes
- 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) ⇒ PropertyTypes
constructor
A new instance of PropertyTypes.
-
#search(key) ⇒ Object
find the substructures necessary for the given resource key.
Constructor Details
#initialize(structs) ⇒ PropertyTypes
Returns a new instance of PropertyTypes.
12 13 14 |
# File 'lib/humidifier/loader.rb', line 12 def initialize(structs) @structs = structs end |
Instance Attribute Details
#structs ⇒ Object (readonly)
Returns the value of attribute structs.
10 11 12 |
# File 'lib/humidifier/loader.rb', line 10 def structs @structs end |
Instance Method Details
#search(key) ⇒ Object
find the substructures necessary for the given resource key
17 18 19 20 21 |
# File 'lib/humidifier/loader.rb', line 17 def search(key) results = structs.keys.grep(/#{key}/) shortened_names = results.map { |result| result.gsub("#{key}.", '') } shortened_names.zip(structs.values_at(*results)).to_h.merge(global) end |