Top Level Namespace

Includes:
Aleph::Delegator

Defined Under Namespace

Modules: Aleph Classes: AddRoute, AddRoutes, Connection, ConnectionInformation, Reply, Request, ShowRoutes

Instance Method Summary collapse

Methods included from Aleph::Delegator

delegate

Instance Method Details

#get_requestObject



13
14
15
# File 'lib/armstrong.rb', line 13

def get_request
  return Actor.receive
end

#process_route(route, pattern, keys, values = []) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/armstrong/main_actors.rb', line 9

def process_route(route, pattern, keys, values = [])
  return unless match = pattern.match(route)
  values += match.captures.map { |v| URI.decode(v) if v }
  params = {}
  
  if values.any?
    keys.zip(values) { |k,v| (params[k] ||= '') << v if v }
  end
  return params
end

#reply(request, body, code = 200, headers = {"Content-type" => "text/html"}) ⇒ Object



17
18
19
# File 'lib/armstrong.rb', line 17

def reply(request, body, code=200, headers={"Content-type" => "text/html"})
  Actor[:replier] << Reply.new(request, body, code, headers)
end

#reply_string(body, code = 200, headers = {"Content-type" => "text/html"}) ⇒ Object



21
22
23
# File 'lib/armstrong.rb', line 21

def reply_string(body, code=200, headers={"Content-type" => "text/html"})
  Actor[:replier] << Reply.new(Actor.receive, body, code, headers)
end