Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from bakkdoor/master

Removed delegator.rb
  • Loading branch information...
commit 2dd8170fafd8d59cdc289f339a8a59be57c1a7d1 2 parents fbb0513 + 07a62f4
Konstantin Haase authored
Showing with 0 additions and 65 deletions.
  1. +0 −1  lib/sinatra.fy
  2. +0 −64 lib/sinatra/delegator.rb
1  lib/sinatra.fy
View
@@ -1,4 +1,3 @@
-require(File expand_path("../sinatra/delegator", __FILE__))
require("sinatra")
class Sinatra Base {
64 lib/sinatra/delegator.rb
View
@@ -1,64 +0,0 @@
-require "delegate"
-
-def DelegateClass(superclass)
- klass = Class.new
- methods = superclass.public_instance_methods(true)
- methods -= ::Kernel.public_instance_methods(false)
- methods -= %w[
- __verify_metaclass__
- copy_from
- singleton_class
- to_marshal
- ]
- methods |= ["to_s","to_a","inspect","==","=~","==="]
-
- klass.module_eval do
- def initialize(obj) # :nodoc:
- @_dc_obj = obj
- end
-
- def method_missing(m, *args) # :nodoc:
- unless @_dc_obj.respond_to?(m)
- super(m, *args)
- end
- @_dc_obj.__send__(m, *args)
- end
-
- def respond_to?(m, include_private=false) # :nodoc:
- return true if super
- return @_dc_obj.respond_to?(m, include_private)
- end
-
- def __getobj__ # :nodoc:
- @_dc_obj
- end
-
- def __setobj__(obj) # :nodoc:
- raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
- @_dc_obj = obj
- end
-
- def clone # :nodoc:
- new = super
- new.__setobj__(__getobj__.clone)
- new
- end
-
- def dup # :nodoc:
- new = super
- new.__setobj__(__getobj__.dup)
- new
- end
- end
-
- methods.each do |method|
- begin
- klass.__send__(:define_method, method) do |*args, &block|
- @_dc_obj.__send__(method, *args, &block)
- end
- rescue SyntaxError
- raise NameError, "invalid identifier #{method}"
- end
- end
- return klass
-end
Please sign in to comment.
Something went wrong with that request. Please try again.