Module: Sinatra::DefaultCharset
- Defined in:
- lib/sinatra/default_charset.rb
Constant Summary collapse
- VERSION =
'0.2.0'
- DEFAULT_FALLBACK =
'utf-8'
- DEFAULT_CHARSET =
charset
Class Method Summary collapse
Instance Method Summary collapse
-
#content_type(type, params = {}) ⇒ Object
Defaults to.
Class Method Details
.registered(app) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/sinatra/default_charset.rb', line 38 def self.registered(app) app.set :default_charset, DEFAULT_CHARSET app.helpers self # re-default it so that we've always got a charset set app.before { content_type :html } end |
Instance Method Details
#content_type(type, params = {}) ⇒ Object
Defaults to
29 30 31 32 33 34 35 36 |
# File 'lib/sinatra/default_charset.rb', line 29 def content_type(type, params = {}) if params.include?(:charset) params.delete(:charset) if params[:charset].nil? else params[:charset] = settings.default_charset end super end |