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 35 def get_attribute(attrs, key) if !attrs.is_a?(Hash) raise MTRubyError, "#{attrs} mush be a Hash!" end if !attrs.has_key?(key) raise MTRubyError, "The :#{key} attribute is not specified." end attrs[key] end