annotate lib/redmine/views/builders/xml.rb @ 1516:b450a9d58aed redmine-2.4

Update to Redmine SVN revision 13356 on 2.4-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:28:31 +0100
parents e248c7af89ec
children
rev   line source
Chris@119 1 # Redmine - project management software
Chris@1494 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
Chris@119 3 #
Chris@119 4 # This program is free software; you can redistribute it and/or
Chris@119 5 # modify it under the terms of the GNU General Public License
Chris@119 6 # as published by the Free Software Foundation; either version 2
Chris@119 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@119 9 # This program is distributed in the hope that it will be useful,
Chris@119 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@119 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@119 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@119 14 # You should have received a copy of the GNU General Public License
Chris@119 15 # along with this program; if not, write to the Free Software
Chris@119 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@119 17
Chris@1115 18 require 'builder'
Chris@1115 19
Chris@119 20 module Redmine
Chris@119 21 module Views
Chris@119 22 module Builders
Chris@119 23 class Xml < ::Builder::XmlMarkup
Chris@1115 24 def initialize(request, response)
Chris@1115 25 super()
Chris@119 26 instruct!
Chris@119 27 end
Chris@909 28
Chris@119 29 def output
Chris@119 30 target!
Chris@119 31 end
Chris@909 32
Chris@119 33 def method_missing(sym, *args, &block)
Chris@1115 34 if args.size == 1 && args.first.is_a?(::Time)
Chris@119 35 __send__ sym, args.first.xmlschema, &block
Chris@119 36 else
Chris@119 37 super
Chris@119 38 end
Chris@119 39 end
Chris@909 40
Chris@119 41 def array(name, options={}, &block)
Chris@119 42 __send__ name, (options || {}).merge(:type => 'array'), &block
Chris@119 43 end
Chris@119 44 end
Chris@119 45 end
Chris@119 46 end
Chris@119 47 end