Class: Locale::Middleware

### Home Classes Methods

### In Files

- lib/locale/middleware.rb

### Parent

Object

### Methods

- ::new
- #call

### Class/Module Index

Quicksearch

- Locale
- Locale::Driver
- Locale::Driver::CGI
- Locale::Driver::Env
- Locale::Driver::Env::Private
- Locale::Driver::JRuby
- Locale::Driver::Posix
- Locale::Driver::Win32
- Locale::Driver::Win32::Kernel32
- Locale::Driver::Win32Table
- Locale::Info
- Locale::Info::Language
- Locale::Info::Region
- Locale::Middleware
- Locale::Tag
- Locale::Tag::Cldr
- Locale::Tag::Common
- Locale::Tag::Irregular
- Locale::Tag::Posix
- Locale::Tag::Rfc
- Locale::Tag::Simple
- Locale::TagList

No matching classes.

# Locale::Middleware

### Public Class Methods

new(application, options={}) click to toggle source

    # File lib/locale/middleware.rb, line 22
    def initialize(application, options={})
      @application = application
      @options = options
      Locale.init(:driver => :cgi)
    end

### Public Instance Methods

call(environment) click to toggle source

    # File lib/locale/middleware.rb, line 28
    def call(environment)
      request = Rack::Request.new(environment)
      Locale.set_request([request["lang"]],
                         [request.cookies["lang"]],
                         environment["HTTP_ACCEPT_LANGUAGE"],
                         environment["HTTP_ACCEPT_CHARSET"])
      @application.call(environment)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.