From 7785812abcf8bafe1167639e75f2b8638708ffaf Mon Sep 17 00:00:00 2001 From: Magnus Holm Date: Mon, 30 Nov 2009 18:36:05 +0100 Subject: [PATCH] Export more ivars in Base --- lib/camping-unabridged.rb | 3 ++- lib/camping.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb index 427110d..b74c71a 100644 --- a/lib/camping-unabridged.rb +++ b/lib/camping-unabridged.rb @@ -232,7 +232,8 @@ def URL c='/',*a # # Everything in this module is accessable inside your controllers. module Base - attr_accessor :input, :cookies, :headers, :body, :status, :root + attr_accessor :env, :request, :root, :input, :cookies, :state, + :status, :headers, :body # Display a view, calling it by its method name +v+. If a layout # method is found in Camping::Views, it will be used to wrap the HTML. diff --git a/lib/camping.rb b/lib/camping.rb index 0551275..342401e 100644 --- a/lib/camping.rb +++ b/lib/camping.rb @@ -10,8 +10,8 @@ def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super end 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 c=self/c;c=@request.url[/.{8,}?(?=\/)/]+c if c[0]==?/;URI c end -end;module Base;attr_accessor:input,:cookies,:headers,:body,:status,:root -def render v,*a,&b;mab(/^_/!~v.to_s){send(v,*a,&b)} 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 def mab l=nil,&b;m=Mab.new({},self);s=m.capture(&b) s=m.capture{layout{s}} if l && m.respond_to?(:layout);s end def r s,b,h={};b,h=h,b if Hash===b;@status=s;