lib/roar/representer/xml.rb in roar-0.8.3 vs lib/roar/representer/xml.rb in roar-0.9.0
- old
+ new
@@ -1,48 +1,44 @@
-require 'roar/representer/base'
+require 'roar/representer'
require 'representable/xml'
module Roar
# Includes #from_xml and #to_xml into your represented object.
# In addition to that, some more options are available when declaring properties.
module Representer
module XML
def self.included(base)
base.class_eval do
- include Base
+ include Representer
include Representable::XML
extend ClassMethods
include InstanceMethods # otherwise Representable overrides our #to_xml.
end
end
module InstanceMethods
- def from_xml(document, options={})
- if block = deserialize_block_for_options(options)
- return super(document, &block)
- end
-
- super
- end
-
def to_xml(*args)
before_serialize(*args)
super
end
# Generic entry-point for rendering.
def serialize(*args)
to_xml(*args)
end
+
+ def deserialize(*args)
+ from_xml(*args)
+ end
end
module ClassMethods
include Representable::XML::ClassMethods
def links_definition_options
- {:from => :link, :as => Hyperlink, :collection => true}
+ {:from => :link, :class => Hyperlink, :collection => true}
end
# Generic entry-point for parsing.
def deserialize(*args)
from_xml(*args)