Sha256: 99306de37e384b97f58c641afbb0e227603aea5d1dc5a74a67f23c686f4c356e
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module Restfulie module Server module Marshalling def to_json(options = {}) Hash.from_xml(to_xml(options)).to_json end # adds a link for each transition to the current xml writer def add_links(xml, all, options) all.each do |transition| add_link(transition, xml, options) end end # adds a link for this transition to the current xml writer def add_link(transition, xml, options) transition = self.class.existing_transitions(transition.to_sym) unless transition.kind_of? Restfulie::Server::Transition transition.add_link_to(xml, self, options) end # marshalls your object to xml. # adds all links if there are any available. def to_xml(options = {}) transitions = all_following_transitions return super(options) if transitions.empty? || options[:controller].nil? options[:skip_types] = true super options do |xml| add_links xml, transitions, options end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restfulie-0.4.0 | lib/restfulie/server/marshalling.rb |