class Object

Public Instance Methods

get_attribute(attrs, key) click to toggle source

Gets an attribute value from the specified hash. Raises exception if the ‘attrs’ parameter is not a hash or if it does not contain the specified key.

# File utils.rb, line 21
def get_attribute(attrs, key)
  if !attrs.is_a?(Hash)
    raise "#{attrs} mush be a Hash!"
  end

  if !attrs.has_key?(key)
    raise "The :#{key} attribute is not specified."
  end

  attrs[key]
end