Class: Sinatra::Default

Class | Sinatra::Default
In: | lib/sinatra/base.rb lib/sinatra/compat.rb lib/sinatra/main.rb
Parent: | Base

Base class for classic style (top-level) applications.

### Methods

configures default_options entity_tag env env= header options render send_data set_option set_options stop

### Public Class methods

configures(*args, &block)

Deprecated. Use: configure

[Source]

         # File lib/sinatra/compat.rb, line 176
    176:       def configures(*args, &block)
    177:         sinatra_warn "The 'configures' method is deprecated; use 'configure' instead."
    178:         configure(*args, &block)
    179:       end

default_options()

Deprecated. Use: set

[Source]

         # File lib/sinatra/compat.rb, line 182
    182:       def default_options
    183:         sinatra_warn "Sinatra::Application.default_options is deprecated; use 'set' instead."
    184:         fake = lambda { |options| set(options) }
    185:         def fake.merge!(options) ; call(options) ; end
    186:         fake
    187:       end

env()

Deprecated. Use: options.environment

[Source]

         # File lib/sinatra/compat.rb, line 207
    207:       def env
    208:         sinatra_warn "The :env option is deprecated; use :environment instead."
    209:         environment
    210:       end

env=(value)

Deprecated. Use: set :environment, ENV

[Source]

         # File lib/sinatra/compat.rb, line 201
    201:       def env=(value)
    202:         sinatra_warn "The :env option is deprecated; use :environment instead."
    203:         set :environment, value
    204:       end

options()

Deprecated. Options are stored directly on the class object.

[Source]

         # File lib/sinatra/compat.rb, line 170
    170:       def options
    171:         sinatra_warn "The 'options' class method is deprecated; use 'self' instead."
    172:         Options.new(self)
    173:       end

set_option(*args, &block)

Deprecated. Use: set

[Source]

         # File lib/sinatra/compat.rb, line 190
    190:       def  set_optionset_option(*args, &block)
    191:         sinatra_warn "The 'set_option' method is deprecated; use 'set' instead."
    192:         set(*args, &block)
    193:       end

set_options(*args, &block)

[Source]

         # File lib/sinatra/compat.rb, line 195
    195:       def set_options(*args, &block)
    196:         sinatra_warn "The 'set_options' method is deprecated; use 'set' instead."
    197:         set(*args, &block)
    198:       end

### Public Instance methods

entity_tag(*args, &block)

Deprecated. Use: etag

[Source]

         # File lib/sinatra/compat.rb, line 102
    102:     def entity_tag(*args, &block)
    103:       sinatra_warn "The 'entity_tag' method is deprecated; use 'etag' instead."
    104:       etag(*args, &block)
    105:     end

header(header=nil)

Deprecated. Use: response[‘Header-Name’]

[Source]

        # File lib/sinatra/compat.rb, line 90
    90:     def header(header=nil)
    91:       sinatra_warn "The 'header' method is deprecated; use 'headers' instead."
    92:       headers(header)
    93:     end

render(engine, template, options={}, locals={}, &bk)

The :views_directory, :options, :haml, and :sass options are deprecated.

[Source]

         # File lib/sinatra/compat.rb, line 119
    119:     def render(engine, template, options={}, locals={}, &bk)
    120:       if options.key?(:views_directory)
    121:         sinatra_warn "The :views_directory option is deprecated; use :views instead."
    122:         options[:views] = options.delete(:views_directory)
    123:       end
    124:       [:options, engine.to_sym].each do |key|
    125:         if options.key?(key)
    126:           sinatra_warn "Passing :#{key} => {} to #{engine} is deprecated; " +
    127:                        "merge options directly into hash instead."
    128:           options.merge! options.delete(key)
    129:         end
    130:       end
    131:       super(engine, template, options, locals, &bk)
    132:     end

send_data(data, options={})

Deprecated. Use the attachment helper and return the data as a String or Array.

[Source]

         # File lib/sinatra/compat.rb, line 109
    109:     def send_data(data, options={})
    110:       sinatra_warn "The 'send_data' method is deprecated. use attachment, status, content_type, etc. helpers instead."
    111:
    112:       status       options[:status]   if options[:status]
    113:       attachment   options[:filename] if options[:disposition] == 'attachment'
    114:       content_type options[:type]     if options[:type]
    115:       halt data
    116:     end

stop(*args, &block)

Deprecated. Use: halt

[Source]

        # File lib/sinatra/compat.rb, line 96
    96:     def stop(*args, &block)
    97:       sinatra_warn "The 'stop' method is deprecated; use 'halt' instead."
    98:       halt(*args, &block)
    99:     end

[Validate]