Sha256: 9bd6609410f14944378c7269d05efeb1ca109469b9e6be7560a7301bba6a5a8b

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 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
    @serializer = Rack::App::Serializer.new(&definition_how_to_serialize) unless definition_how_to_serialize.nil?
    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

4 entries across 4 versions & 1 rubygems

Version Path
rack-app-5.4.0 lib/rack/app/singleton_methods/settings.rb
rack-app-5.3.2 lib/rack/app/singleton_methods/settings.rb
rack-app-5.3.1 lib/rack/app/singleton_methods/settings.rb
rack-app-5.3.0 lib/rack/app/singleton_methods/settings.rb