Sha256: 0be81884c579aacd7c7543fd76de6f5f604556d901061a69f31d5e5c05ac00a4

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

module Restfulie
  
  module Server
  
    module Marshalling
  
      def to_json
        super :methods => :following_states
      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

      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.3 lib/restfulie/server/marshalling.rb