Skip to content

Commit

Permalink
Attempt at 1.9 support (thanks babalela!)
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Feb 21, 2010
1 parent bb4c155 commit 381b9cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class H < Hash
def method_missing(m,*a)
m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super
end
undef id, type
undef id, type if ?? == 63
end

# Helpers contains methods available in your controllers and views. You may
Expand Down
4 changes: 2 additions & 2 deletions lib/camping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
S=IO.read(__FILE__)rescue nil;P="<h1>Cam\ping Problem!</h1><h2>%s</h2>"
U=Rack::Utils;Apps=[];class H<Hash
def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super end
undef id,type;end;module Helpers;def R c,*g
undef id,type if ??==63;end;module Helpers;def R c,*g
p,h=/\(.+?\)/,g.grep(Hash);g-=h;raise"bad route"unless u=c.urls.find{|x|
break x if x.scan(p).size==g.size&&/^#{x}\/?$/=~(x=g.inject(x){|x,a|
x.sub p,U.escape((a[a.class.primary_key]rescue a))})}
h.any?? u+"?"+U.build_query(h[0]):u end;def / p
p[0]==?/?@root+p:p end;def URL c='/',*a;c=R(c, *a) if c.respond_to?:urls
p[0]==?/?@root + p : p end;def URL c='/',*a;c=R(c, *a) if c.respond_to?:urls
c=self/c;c=@request.url[/.{8,}?(?=\/)/]+c if c[0]==?/;URI c end
end;module Base;attr_accessor:env,:request,:root,:input,:cookies,:state,
:status, :headers, :body;def render v,*a,&b;mab(/^_/!~v.to_s){send(v,*a,&b)} end
Expand Down
7 changes: 5 additions & 2 deletions lib/camping/reloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ class Reloader
# This is a simple wrapper which causes the script to reload (if needed)
# on any method call. Then the method call will be forwarded to the
# app.
class App # :nodoc:
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
class App < (defined?(BasicObject) ? BasicObject : Object) # :nodoc:
if superclass == ::Object
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
end

attr_accessor :app, :script

def initialize(script)
Expand Down

0 comments on commit 381b9cb

Please sign in to comment.