# File lib/puppet/parser/resource.rb, line 110
110:     def initialize(options)
111:         # Set all of the options we can.
112:         options.each do |option, value|
113:             if respond_to?(option.to_s + "=")
114:                 send(option.to_s + "=", value)
115:                 options.delete(option)
116:             end
117:         end
118: 
119:         unless self.scope
120:             raise ArgumentError, "Resources require a scope"
121:         end
122:         @source ||= scope.source
123: 
124:         options = symbolize_options(options)
125: 
126:         # Set up our reference.
127:         if type = options[:type] and title = options[:title]
128:             options.delete(:type)
129:             options.delete(:title)
130:         else
131:             raise ArgumentError, "Resources require a type and title"
132:         end
133: 
134:         @ref = Reference.new(:type => type, :title => title, :scope => self.scope)
135: 
136:         @params = {}
137: 
138:         # Define all of the parameters
139:         if params = options[:params]
140:             options.delete(:params)
141:             params.each do |param|
142:                 # Don't set the same parameter twice
143:                 if @params[param.name]
144:                     self.fail Puppet::ParseError, "Duplicate parameter '%s' for on %s" %
145:                         [param.name, self.to_s]
146:                 end
147: 
148:                 set_parameter(param)
149:             end
150:         end
151: 
152:         # Throw an exception if we've got any arguments left to set.
153:         unless options.empty?
154:             raise ArgumentError, "Resources do not accept %s" % options.keys.collect { |k| k.to_s }.join(", ")
155:         end
156: 
157:         tag(@ref.type)
158:         tag(@ref.title) if valid_tag?(@ref.title.to_s)
159:     end