Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #2 from bakkdoor/master

Removed delegator.rb
  • Loading branch information...
commit 2dd8170fafd8d59cdc289f339a8a59be57c1a7d1 2 parents fbb0513 + 07a62f4
Konstantin Haase authored

Showing 2 changed files with 0 additions and 65 deletions. Show diff stats Hide diff stats

  1. +0 1  lib/sinatra.fy
  2. +0 64 lib/sinatra/delegator.rb
1  lib/sinatra.fy
... ... @@ -1,4 +1,3 @@
1   -require(File expand_path("../sinatra/delegator", __FILE__))
2 1 require("sinatra")
3 2
4 3 class Sinatra Base {
64 lib/sinatra/delegator.rb
... ... @@ -1,64 +0,0 @@
1   -require "delegate"
2   -
3   -def DelegateClass(superclass)
4   - klass = Class.new
5   - methods = superclass.public_instance_methods(true)
6   - methods -= ::Kernel.public_instance_methods(false)
7   - methods -= %w[
8   - __verify_metaclass__
9   - copy_from
10   - singleton_class
11   - to_marshal
12   - ]
13   - methods |= ["to_s","to_a","inspect","==","=~","==="]
14   -
15   - klass.module_eval do
16   - def initialize(obj) # :nodoc:
17   - @_dc_obj = obj
18   - end
19   -
20   - def method_missing(m, *args) # :nodoc:
21   - unless @_dc_obj.respond_to?(m)
22   - super(m, *args)
23   - end
24   - @_dc_obj.__send__(m, *args)
25   - end
26   -
27   - def respond_to?(m, include_private=false) # :nodoc:
28   - return true if super
29   - return @_dc_obj.respond_to?(m, include_private)
30   - end
31   -
32   - def __getobj__ # :nodoc:
33   - @_dc_obj
34   - end
35   -
36   - def __setobj__(obj) # :nodoc:
37   - raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
38   - @_dc_obj = obj
39   - end
40   -
41   - def clone # :nodoc:
42   - new = super
43   - new.__setobj__(__getobj__.clone)
44   - new
45   - end
46   -
47   - def dup # :nodoc:
48   - new = super
49   - new.__setobj__(__getobj__.dup)
50   - new
51   - end
52   - end
53   -
54   - methods.each do |method|
55   - begin
56   - klass.__send__(:define_method, method) do |*args, &block|
57   - @_dc_obj.__send__(method, *args, &block)
58   - end
59   - rescue SyntaxError
60   - raise NameError, "invalid identifier #{method}"
61   - end
62   - end
63   - return klass
64   -end

0 comments on commit 2dd8170

Please sign in to comment.
Something went wrong with that request. Please try again.