Method: Sensu::Utilities#find_attribute_value
- Defined in:
- lib/sensu/utilities.rb
#find_attribute_value(tree, path, default) ⇒ Object
Traverse a hash for an attribute value, with a fallback default value if nil.
169 170 171 172 173 174 175 176 |
# File 'lib/sensu/utilities.rb', line 169 def find_attribute_value(tree, path, default) attribute = tree[path.shift] if attribute.is_a?(Hash) find_attribute_value(attribute, path, default) else attribute.nil? ? default : attribute end end |