Sha256: a674ed50503186a81bb72392ab437ad51c201328bcd5828b88ed6c8cbb198585

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

module Pakyow
  # For methods that should be accessible anywhere
  module Helpers
    def context
      @context or raise NoContextError
    end

    def logger
      request.logger
    end

    def router
      RouteLookup.new
    end

    def request
      context.request
    end
    alias_method :req, :request

    def response
      context.response
    end
    alias_method :res, :response

    def params
      request.params
    end

    def session
      request.session
    end

    def cookies
      request.cookies
    end

    def config
      Pakyow::Config
    end
  end

  # For methods that should only be accessible through App
  module AppHelpers; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pakyow-core-0.9.1 pakyow-core/lib/core/helpers.rb
pakyow-core-0.9.0 pakyow-core/lib/core/helpers.rb