lib/rack/app/serializer.rb in rack-app-5.2.0 vs lib/rack/app/serializer.rb in rack-app-5.3.0
- old
+ new
@@ -1,14 +1,10 @@
class Rack::App::Serializer
attr_reader :logic
- def initialize
- @logic = lambda { |o| o.to_s }
- end
-
- def set_serialization_logic(proc)
- @logic = proc
+ def initialize(&block)
+ @logic = block || lambda { |o| o.to_s }
end
def serialize(object)
String(@logic.call(object))
end