Method: ATD::Route#delete

Defined in:
lib/atd.rb

#delete(path = nil, *args) ⇒ Object

Sets route to receive a delete request to path and execute the block provided (if one is provided)

Parameters:

  • (defaults to: nil)

    The path at which the route should receive from.

Returns:

  • ATD::Route



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/atd.rb', line 77

[:get, :post, :put, :delete, :patch].each do |method|
  define_method(method) do |*args, &block|
    # This conditional allows the syntax get post put "/", "Hello" because it passes
    # the variables up through the different method calls.
    if args.first.is_a?(ATD::Route)
      @method = args.first.method
      @filename = args.first.filename
      @output = args.first.output
      @path = args.first.path
      @args = args.first.args
      @block = args.first.block
      @app = args.first.app
      @actions = args.first.actions
    end
    @method = [method] if @method.length == 5
    @method += [method]
    @method.uniq!
    parse_args(*args, &block)
  end
end