judofyr / filtering_camping

Adding before/after-filters to Camping

This URL has Read+Write access

judofyr (author)
Sat Jun 07 10:26:04 -0700 2008
filtering_camping / README
100644 43 lines (34 sloc) 0.589 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Only tested on latest HEAD
 
require 'rubygems'
require 'camping'
require 'filtering_camping'
 
Camping.goes :Filters
 
module Filters
  include FilteringCamping
  
  before :Index do
    @hello = 2
  end
  
  before '/login' do
    @world = 3
  end
  
  before :all do
    @var = 1
  end
  
  module Controllers
    class Index < R '/'
      def get
        (@hello == 2).to_s
      end
    end
    
    class Login < R '/login'
      def get
        (@world == 4).to_s
      end
    end
    
    class AnotherOne < R '/@'
      def get
        (@var == 1).to_s
      end
    end
  end
end