# File lib/chef/run_list/run_list_item.rb, line 28 def initialize(item) case item when Hash assert_hash_is_valid_run_list_item!(item) @type = (item['type'] || item[:type]).to_sym @name = item['name'] || item[:name] when String if match = QUALIFIED_RECIPE.match(item) @type = :recipe @name = match[1] elsif match = QUALIFIED_ROLE.match(item) @type = :role @name = match[1] else @type = :recipe @name = item end else raise ArgumentError, "Unable to create #{self.class} from #{item.class}:#{item.inspect}: must be a Hash or String" end end