Module: Landline::DSL::PathConstructors

Included in:
App, PathContext
Defined in:
lib/landline/dsl/constructors_path.rb,
lib/landline/extensions/websocket.rb

Overview

Path (and subclasses) DSL constructors

Instance Method Summary collapse

Instance Method Details

#connect(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::CONNECTHandler object



79
80
81
82
83
84
# File 'lib/landline/dsl/constructors_path.rb', line 79

def connect(path, **args, &setup)
  register(Landline::Handlers::CONNECT.new(path,
                                           parent: @origin,
                                           **args,
                                           &setup))
end

#delete(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::DELETEHandler object



70
71
72
73
74
75
# File 'lib/landline/dsl/constructors_path.rb', line 70

def delete(path, **args, &setup)
  register(Landline::Handlers::DELETE.new(path,
                                          parent: @origin,
                                          **args,
                                          &setup))
end

#get(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::GETHandler object



34
35
36
37
38
39
# File 'lib/landline/dsl/constructors_path.rb', line 34

def get(path, **args, &setup)
  register(Landline::Handlers::GET.new(path,
                                       parent: @origin,
                                       **args,
                                       &setup))
end

#head(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::HEADHandler object



61
62
63
64
65
66
# File 'lib/landline/dsl/constructors_path.rb', line 61

def head(path, **args, &setup)
  register(Landline::Handlers::HEAD.new(path,
                                        parent: @origin,
                                        **args,
                                        &setup))
end

(in Landline::Path context) Create a new application crosscall link (acts like #call in probe context and strips its path from request)



121
122
123
124
125
# File 'lib/landline/dsl/constructors_path.rb', line 121

def link(path, application)
  register(Landline::Handlers::Link.new(path,
                                        application,
                                        parent: @origin))
end

#options(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::OPTIONSHandler object



106
107
108
109
110
111
# File 'lib/landline/dsl/constructors_path.rb', line 106

def options(path, **args, &setup)
  register(Landline::Handlers::OPTIONS.new(path,
                                           parent: @origin,
                                           **args,
                                           &setup))
end

#patch(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::PATCHHandler object



97
98
99
100
101
102
# File 'lib/landline/dsl/constructors_path.rb', line 97

def patch(path, **args, &setup)
  register(Landline::Handlers::PATCH.new(path,
                                         parent: @origin,
                                         **args,
                                         &setup))
end

#path(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Path object



20
21
22
# File 'lib/landline/dsl/constructors_path.rb', line 20

def path(path, **args, &setup)
  register(Landline::Path.new(path, parent: @origin, **args, &setup))
end

#post(path, **args, &setup) ⇒ Object

(in Landline::Path context) create a new Handlers::POSTHandler object



43
44
45
46
47
48
# File 'lib/landline/dsl/constructors_path.rb', line 43

def post(path, **args, &setup)
  register(Landline::Handlers::POST.new(path,
                                        parent: @origin,
                                        **args,
                                        &setup))
end

#probe(path, **args, &_setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::Probe object



26
27
28
29
30
# File 'lib/landline/dsl/constructors_path.rb', line 26

def probe(path, **args, &_setup)
  register(Landline::Handlers::Probe.new(path,
                                         parent: @origin,
                                         **args))
end

#put(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::PUTHandler object



52
53
54
55
56
57
# File 'lib/landline/dsl/constructors_path.rb', line 52

def put(path, **args, &setup)
  register(Landline::Handlers::PUT.new(path,
                                       parent: @origin,
                                       **args,
                                       &setup))
end

#register(obj) ⇒ Object

(in Landline::Path context) Append a Node child object to the list of children



10
11
12
13
14
15
16
# File 'lib/landline/dsl/constructors_path.rb', line 10

def register(obj)
  unless obj.is_a? Landline::Node
    raise ArgumentError, "register accepts node children only"
  end

  @origin.children.append(obj)
end

#serve(path) ⇒ Object

(in Landline::Path context) Create a new Handlers::GETHandler that serves static files



115
116
117
# File 'lib/landline/dsl/constructors_path.rb', line 115

def serve(path)
  register(Landline::Handlers::Serve.new(path, parent: @origin))
end

#trace(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new Handlers::TRACEHandler object



88
89
90
91
92
93
# File 'lib/landline/dsl/constructors_path.rb', line 88

def trace(path, **args, &setup)
  register(Landline::Handlers::TRACE.new(path,
                                         parent: @origin,
                                         **args,
                                         &setup))
end

#websocket(path, **args, &setup) ⇒ Object

(in Landline::Path context) Create a new websocket handler



276
277
278
279
280
281
# File 'lib/landline/extensions/websocket.rb', line 276

def websocket(path, **args, &setup)
  register(Landline::Handlers::WebSockServer.new(path,
                                                 parent: @origin,
                                                 **args,
                                                 &setup))
end