responder.rb

Path: lib/cheat/responder.rb
Last Update: Sat Feb 23 07:17:10 +0000 2019

class Something < R ‘route‘

  include Responder

  def get
   ... important code ...

    respond_to do |wants|
      wants.html { render :something }
      wants.text { "Just some text." }
      wants.yaml { "Something neat!".to_yaml }
      wants.xml  { "Also, XML.".to_xml }
    end
  end

end

[Validate]