lib/sensu/utilities.rb
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
# Traverse a hash for an attribute value, with a fallback default
# value if nil.
#
# @param tree [Hash] to traverse.
# @param path [Array] of attribute keys.
# @param default [Object] value if attribute value is nil.
# @return [Object] attribute or fallback default value.
Traverse a hash for an attribute value, with a fallback default
value if nil.
Traverse a hash for an attribute value with a fallback default value if nil .
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
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
Traverse a hash for an attribute value, with a fallback default
value if nil.
Traverse a hash for an attribute value with a fallback default value if nil .
attribute or fallback default value.
attribute or fallback default value .
Object
tree
None
path
of attribute keys.
of attribute keys .
default
value if attribute value is nil.
value if attribute value is nil .