Module: Hyde::DSL::PathConstructors

Included in:
PathBinding
Defined in:
lib/hyde/dsl/path_constructors.rb

Overview

Path (and subclasses) DSL constructors

Instance Method Summary collapse

Instance Method Details

#connect(path, &setup) ⇒ Object

Create a new CONNECTHandler object



55
56
57
# File 'lib/hyde/dsl/path_constructors.rb', line 55

def connect(path, &setup)
  register(Hyde::CONNECTHandler.new(path, parent: @origin, &setup))
end

#delete(path, &setup) ⇒ Object

Create a new Hyde::DELETEHandler object



50
51
52
# File 'lib/hyde/dsl/path_constructors.rb', line 50

def delete(path, &setup)
  register(Hyde::DELETEHandler.new(path, parent: @origin, &setup))
end

#get(path, &setup) ⇒ Object

Create a new GETHandler object



30
31
32
# File 'lib/hyde/dsl/path_constructors.rb', line 30

def get(path, &setup)
  register(Hyde::GETHandler.new(path, parent: @origin, &setup))
end

#head(path, &setup) ⇒ Object

Create a new HEADHandler object



45
46
47
# File 'lib/hyde/dsl/path_constructors.rb', line 45

def head(path, &setup)
  register(Hyde::HEADHandler.new(path, parent: @origin, &setup))
end

#options(path, &setup) ⇒ Object

Create a new OPTIONSHandler object



70
71
72
# File 'lib/hyde/dsl/path_constructors.rb', line 70

def options(path, &setup)
  register(Hyde::OPTIONSHandler.new(path, parent: @origin, &setup))
end

#patch(path, &setup) ⇒ Object

Create a new PATCHHandler object



65
66
67
# File 'lib/hyde/dsl/path_constructors.rb', line 65

def patch(path, &setup)
  register(Hyde::PATCHHandler.new(path, parent: @origin, &setup))
end

#path(path, &setup) ⇒ Object

Create a new Path object



18
19
20
21
22
# File 'lib/hyde/dsl/path_constructors.rb', line 18

def path(path, &setup)
  # i don't know WHAT is wrong with this thing. it just is wrong.
  # @sg-ignore
  register(Hyde::Path.new(path, parent: @origin, &setup))
end

#post(path, &setup) ⇒ Object

create a new POSTHandler object



35
36
37
# File 'lib/hyde/dsl/path_constructors.rb', line 35

def post(path, &setup)
  register(Hyde::POSTHandler.new(path, parent: @origin, &setup))
end

#probe(path, &_setup) ⇒ Object

Create a new Probe object



25
26
27
# File 'lib/hyde/dsl/path_constructors.rb', line 25

def probe(path, &_setup)
  register(Hyde::Probe.new(path, parent: @origin))
end

#put(path, &setup) ⇒ Object

Create a new PUTHandler object



40
41
42
# File 'lib/hyde/dsl/path_constructors.rb', line 40

def put(path, &setup)
  register(Hyde::PUTHandler.new(path, parent: @origin, &setup))
end

#register(obj) ⇒ Object

Append a Node child object to the list of children



9
10
11
12
13
14
15
# File 'lib/hyde/dsl/path_constructors.rb', line 9

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

  @origin.children.append(obj)
end

#serve(path) ⇒ Object

Create a new GETHandler that serves static files



75
76
77
# File 'lib/hyde/dsl/path_constructors.rb', line 75

def serve(path)
  register(Hyde::ServeHandler.new(path, parent: @origin))
end

#trace(path, &setup) ⇒ Object

Create a new TRACEHandler object



60
61
62
# File 'lib/hyde/dsl/path_constructors.rb', line 60

def trace(path, &setup)
  register(Hyde::TRACEHandler.new(path, parent: @origin, &setup))
end