lib/rubrowser/renderer.rb in rubrowser-2.7.1 vs lib/rubrowser/renderer.rb in rubrowser-2.8.0
- old
+ new
@@ -10,11 +10,15 @@
def self.call(options = {})
new(options).call
end
def call
- output.write(erb(:index))
+ if @json
+ output.write(data)
+ else
+ output.write(erb(:index))
+ end
end
private
include ERB::Util
@@ -25,9 +29,10 @@
@output = output_file(options[:output])
@layout = options[:layout]
@server = options[:server]
@files = options[:files]
@toolbox = options[:toolbox]
+ @json = !!options[:json]
end
def output_file(path)
path.is_a?(String) ? File.open(path, 'w') : path
end