Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Argonaut can handle .xml.argonaut

  • Loading branch information...
commit cfa0906a83ecbee2db4710dc498a2a49f06f0897 1 parent 2864318
@jbr authored
Showing with 6 additions and 10 deletions.
  1. +5 −9 lib/argonaut.rb
  2. +1 −1  lib/argonaut_template_handler.rb
View
14 lib/argonaut.rb
@@ -1,6 +1,6 @@
require 'json'
class Argonaut
- instance_methods.each {|m| undef_method(m) unless %w(__id__ __send__ to_json instance_eval nil? is_a?).include?(m.to_s)}
+ instance_methods.each {|m| undef_method(m) unless %w(__id__ __send__ to_json to_xml instance_eval nil? is_a? class).include?(m.to_s)}
def initialize(&blk)
@hash = {}
@@ -23,13 +23,9 @@ def method_missing(key, *values)
end
end
+ def respond_to?(method) true end
+ def to_xml(options = {}) @hash.to_xml(options) end
def to_json() @hash.to_json end
-
- def to_s
- @hash.to_s
- end
-
- def inspect
- @hash.inspect
- end
+ def to_s() @hash.to_s end
+ def inspect() @hash.inspect end
end
View
2  lib/argonaut_template_handler.rb
@@ -11,7 +11,7 @@ def self.line_offset() 2 end
def compile(template) %{
doc = ::Argonaut.new do |doc|
#{template.source}
- end.to_json
+ end.to_#{template.format} #{":root => 'response'" if template.format == 'xml'}
} end
def cache_fragment(block, name = {}, options = nil)
Please sign in to comment.
Something went wrong with that request. Please try again.