Sha256: ee757d22f7b6edeae2ad7311ce30aa7ff01c741f03b45b8a43991b3c383061c6

Contents?: true

Size: 464 Bytes

Versions: 52

Compression:

Stored size: 464 Bytes

Contents

module Rack::App::SingletonMethods::Formats
  def formats(&descriptor)
    @formats_builder ||= Rack::App::Serializer::FormatsBuilder.new
    unless descriptor.nil?
      @formats_builder.instance_exec(&descriptor)
      router.reset
    end
    @formats_builder
  end

  def serializer(default_content_type = nil, &how_to_serialize)
    formats { default(default_content_type, &how_to_serialize) } unless how_to_serialize.nil?
    formats.to_serializer
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/singleton_methods/formats.rb
rack-app-11.0.1 lib/rack/app/singleton_methods/formats.rb
rack-app-11.0.0 lib/rack/app/singleton_methods/formats.rb
rack-app-10.0.0 lib/rack/app/singleton_methods/formats.rb
rack-app-9.0.0 lib/rack/app/singleton_methods/formats.rb
rack-app-8.1.0 lib/rack/app/singleton_methods/formats.rb
rack-app-8.0.1 lib/rack/app/singleton_methods/formats.rb
rack-app-8.0.0 lib/rack/app/singleton_methods/formats.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/singleton_methods/formats.rb
rack-app-7.7.0 lib/rack/app/singleton_methods/formats.rb
rack-app-7.6.5 lib/rack/app/singleton_methods/formats.rb
rack-app-7.6.4 lib/rack/app/singleton_methods/formats.rb
rack-app-7.6.3 lib/rack/app/singleton_methods/formats.rb
rack-app-7.6.2 lib/rack/app/singleton_methods/formats.rb
rack-app-7.6.1 lib/rack/app/singleton_methods/formats.rb
rack-app-7.6.0 lib/rack/app/singleton_methods/formats.rb
rack-app-7.5.2 lib/rack/app/singleton_methods/formats.rb
rack-app-7.5.1 lib/rack/app/singleton_methods/formats.rb
rack-app-7.5.0 lib/rack/app/singleton_methods/formats.rb
rack-app-7.4.0 lib/rack/app/singleton_methods/formats.rb