123456789_123456789_123456789_123456789_123456789_

Module: Sinatra::Delegator

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/sinatra/base.rb

Overview

::Sinatra delegation mixin. Mixing this module into an object causes all methods to be delegated to the Application class. Used primarily at the top-level.

Class Attribute Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Class Attribute Details

.target (rw)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2117

attr_accessor :target

Class Method Details

.delegate(*methods)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2098

def self.delegate(*methods)
  methods.each do |method_name|
    define_method(method_name) do |*args, &block|
      return super(*args, &block) if respond_to? method_name

      Delegator.target.send(method_name, *args, &block)
    end
    # ensure keyword argument passing is compatible with ruby >= 2.7
    ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true)
    private method_name
  end
end

Instance Attribute Details

#after (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#before (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#configure (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#delete (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#disable (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#enable (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#error (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#get (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#head (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#helpers (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#layout (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#mime_type (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#not_found (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#on_start (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#on_stop (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#options (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#patch (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#post (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#put (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#register (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#set (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#settings (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#template (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#use (readonly)

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

Instance Method Details

#development?Boolean

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#production?Boolean

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop

#test?Boolean

[ GitHub ]

  
# File 'lib/sinatra/base.rb', line 2111

delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink,
         :template, :layout, :before, :after, :error, :not_found, :configure,
         :set, :mime_type, :enable, :disable, :use, :development?, :test?,
         :production?, :helpers, :settings, :register, :on_start, :on_stop