Brian Candler wrote: > It is a special case: when the last argument to a method call is a hash, > then you can omit the outer braces. the hash options I saw in atom_feed , but it doesn't the last argument. ============================================================== def atom_feed(options = {}, &block) 95: if options[:schema_date] 96: options[:schema_date] = options[:schema_date].strftime("%Y-%m-%d") if options[:schema_date].respond_to?(:strftime) 97: else 98: options[:schema_date] = "2005" # The Atom spec copyright date 99: end 100: 101: xml = options[:xml] || eval("xml", block.binding) 102: xml.instruct! 103: if options[:instruct] 104: options[:instruct].each do |target,attrs| 105: if attrs.respond_to?(:keys) 106: xml.instruct!(target, attrs) 107: elsif attrs.respond_to?(:each) 108: attrs.each { |attr_group| xml.instruct!(target, attr_group) } 109: end 110: end 111: end 112: 113: feed_opts = {"xml:lang" => options[:language] || "en-US", "xmlns" => 'http://www.w3.org/2005/Atom'} 114: feed_opts.merge!(options).reject!{|k,v| !k.to_s.match(/^xml/)} 115: 116: xml.feed(feed_opts) do 117: xml.id(options[:id] || "tag:#{request.host},#{options[:schema_date]}:#{request.request_uri.split(".")[0]}") 118: xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:root_url] || (request.protocol + request.host_with_port)) 119: xml.link(:rel => 'self', :type => 'application/atom+xml', :href => options[:url] || request.url) 120: 121: yield AtomFeedBuilder.new(xml, self, options) 122: end 123: end -- Posted via http://www.ruby-forum.com/.