Class: Usher::Interface::RackInterface::Builder

Inherits:
Rack::Builder
  • Object
show all
Defined in:
lib/usher/interface/rack_interface.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Builder

Returns a new instance of Builder.



7
8
9
10
# File 'lib/usher/interface/rack_interface.rb', line 7

def initialize(&block)
  @usher = Usher::Interface::RackInterface.new
  super
end

Instance Method Details

#delete(path, options = nil, &block) ⇒ Object



29
30
31
# File 'lib/usher/interface/rack_interface.rb', line 29

def delete(path, options = nil, &block)
  self.map(path, options.merge!(:conditions => {:request_method => "DELETE"}), &block)
end

#get(path, options = nil, &block) ⇒ Object



17
18
19
# File 'lib/usher/interface/rack_interface.rb', line 17

def get(path, options = nil, &block)
  self.map(path, options.merge!(:conditions => {:request_method => "GET"}), &block)
end

#map(path, options = nil, &block) ⇒ Object



12
13
14
15
# File 'lib/usher/interface/rack_interface.rb', line 12

def map(path, options = nil, &block)
  @usher.add(path, options).to(&block)
  @ins << @usher unless @ins.last == @usher
end

#post(path, options = nil, &block) ⇒ Object



21
22
23
# File 'lib/usher/interface/rack_interface.rb', line 21

def post(path, options = nil, &block)
  self.map(path, options.merge!(:conditions => {:request_method => "POST"}), &block)
end

#put(path, options = nil, &block) ⇒ Object



25
26
27
# File 'lib/usher/interface/rack_interface.rb', line 25

def put(path, options = nil, &block)
  self.map(path, options.merge!(:conditions => {:request_method => "PUT"}), &block)
end