lib/almodovar/resource_presenter/link.rb in almodovar-0.8.0 vs lib/almodovar/resource_presenter/link.rb in almodovar-0.9.0
- old
+ new
@@ -1,13 +1,14 @@
module Almodovar
class ResourcePresenter
class Link
- attr_reader :rel, :href, :expand_resource, :expand_args
+ attr_reader :rel, :href, :expand_resource, :expand_args, :attributes
def initialize(*args)
- @rel, @href, @expand_resource, @expand_args = args
+ @rel, @href, @expand_resource, @expand_args, @attributes = args
+ @attributes ||= {}
end
def to_xml(options = {})
XmlSerializer.new(self, options.merge(:skip_instruct => true)).to_xml
end
@@ -58,10 +59,10 @@
end
class XmlSerializer < Serializer
def to_xml
- builder.link :rel => link.rel, :href => link.href, &expand_block
+ builder.link link.attributes.merge(:rel => link.rel, :href => link.href), &expand_block
end
private
def builder