Class: ActionDispatch::Routing::RouteSet

Inherits:
Object
  • Object
show all
Defined in:
lib/post-em-all.rb

Instance Method Summary collapse

Instance Method Details

#draw(&block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/post-em-all.rb', line 4

def draw(&block)
  clear! unless @disable_clear_and_finalize

  mapper = Mapper.new(self)
  if block.arity == 1
    mapper.instance_exec(DeprecatedMapper.new(self), &block)
  else
    scoped = Proc.new {
      scope "get" do
        mapper.instance_exec(&block)
      end
    }
    mapper.instance_exec(&scoped)
    mapper.instance_exec(&block)
  end

  finalize! unless @disable_clear_and_finalize

  nil
end