Module: Sinatra::Delegator
- Defined in:
- lib/sinatra/base.rb
Overview
Sinatra delegation mixin. Mixing this module into an object causes all methods to be delegated to the Sinatra::Application class. Used primarily at the top-level.
Class Attribute Summary collapse
-
.target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
-
.delegate(*methods) ⇒ Object
:nodoc:.
Class Attribute Details
.target ⇒ Object
Returns the value of attribute target.
1669 1670 1671 |
# File 'lib/sinatra/base.rb', line 1669 def target @target end |
Class Method Details
.delegate(*methods) ⇒ Object
:nodoc:
1653 1654 1655 1656 1657 1658 1659 1660 1661 |
# File 'lib/sinatra/base.rb', line 1653 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 private method_name end end |