# File lib/active_resource/base.rb, line 974 def encode(options={}) case self.class.format when ActiveResource::Formats[:xml] self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options)) when ActiveResource::Formats::JsonFormat if ActiveResource::Base.include_root_in_json self.class.format.encode({self.class.element_name => attributes}, options) else self.class.format.encode(attributes, options) end else self.class.format.encode(attributes, options) end end