Module: Rack::App::SingletonMethods::Formats
- Included in:
- Rack::App::SingletonMethods
- Defined in:
- lib/rack/app/singleton_methods/formats.rb
Instance Method Summary collapse
Instance Method Details
#formats(&descriptor) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/rack/app/singleton_methods/formats.rb', line 2 def formats(&descriptor) @formats_builder ||= Rack::App::Serializer::FormatsBuilder.new unless descriptor.nil? @formats_builder.instance_exec(&descriptor) router.reset end @formats_builder end |
#serializer(default_content_type = nil, &how_to_serialize) ⇒ Object
11 12 13 14 |
# File 'lib/rack/app/singleton_methods/formats.rb', line 11 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 |