Sha256: be7587362727f3ce94fd26caed2ca641466036dae4dae327a64d11bbb06ea13e

Contents?: true

Size: 819 Bytes

Versions: 5

Compression:

Stored size: 819 Bytes

Contents

module Rack::App::SingletonMethods::Settings

  def cli(&block)
    @cli ||= Rack::App::CLI.new
    @cli.instance_exec(&block) unless block.nil?
    @cli
  end

  protected

  def serializer(&definition_how_to_serialize)
    @serializer ||= Rack::App::Serializer.new

    unless definition_how_to_serialize.nil?
      @serializer.set_serialization_logic(definition_how_to_serialize)
    end

    return @serializer
  end

  def headers(new_headers=nil)
    middleware do |b|
      b.use(Rack::App::Middlewares::HeaderSetter,new_headers)
    end if new_headers.is_a?(Hash)

    new_headers
  end

  def error(*exception_classes, &block)
    @error_handler ||= Rack::App::ErrorHandler.new
    unless block.nil?
      @error_handler.register_handler(exception_classes, block)
    end

    return @error_handler
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-app-5.2.0 lib/rack/app/singleton_methods/settings.rb
rack-app-5.1.0 lib/rack/app/singleton_methods/settings.rb
rack-app-5.0.0 lib/rack/app/singleton_methods/settings.rb
rack-app-5.0.0.rc2 lib/rack/app/singleton_methods/settings.rb
rack-app-5.0.0.rc1 lib/rack/app/singleton_methods/settings.rb