lib/roda/plugins/json.rb in roda-1.3.0 vs lib/roda/plugins/json.rb in roda-2.0.0
- old
+ new
@@ -31,16 +31,18 @@
# can specifically set the allowed classes to json by adding
# using the :classes option when loading the plugin:
#
# plugin :json, :classes=>[Array, Hash, Sequel::Model]
module Json
+ OPTS = {}.freeze
+
# Set the classes to automatically convert to JSON
- def self.configure(app, opts={})
+ def self.configure(app, opts=OPTS)
classes = opts[:classes] || [Array, Hash]
app.opts[:json_result_classes] ||= []
app.opts[:json_result_classes] += classes
app.opts[:json_result_classes].uniq!
- app.opts[:json_result_classes].extend(RodaDeprecateMutation)
+ app.opts[:json_result_classes].freeze
end
module ClassMethods
# The classes that should be automatically converted to json
def json_result_classes