Module: Holoserve::Interface::Control::Helper

Instance Method Summary collapse

Instance Method Details

#bad_requestObject



25
26
27
# File 'lib/holoserve/interface/control.rb', line 25

def bad_request
  [ 400, { }, [ "bad request" ] ]
end

#bucketObject



33
34
35
# File 'lib/holoserve/interface/control.rb', line 33

def bucket
  config[:bucket] ||= [ ]
end

#historyObject



37
38
39
# File 'lib/holoserve/interface/control.rb', line 37

def history
  config[:history] ||= [ ]
end

#not_foundObject



29
30
31
# File 'lib/holoserve/interface/control.rb', line 29

def not_found
  [ 404, { }, [ "not found" ] ]
end

#ok(content, content_type = "text/plain") ⇒ Object



21
22
23
# File 'lib/holoserve/interface/control.rb', line 21

def ok(content, content_type = "text/plain")
  [ 200, { "Content-Type" => content_type }, [ content ] ]
end

#pairsObject



41
42
43
# File 'lib/holoserve/interface/control.rb', line 41

def pairs
  config[:pairs] ||= options[:pairs]
end

#respond_json(object) ⇒ Object



17
18
19
# File 'lib/holoserve/interface/control.rb', line 17

def respond_json(object)
  ok JSON.dump(object), "application/json"
end

#respond_json_acknowledgementObject



13
14
15
# File 'lib/holoserve/interface/control.rb', line 13

def respond_json_acknowledgement
  respond_json :ok => true
end

#stateObject



45
46
47
# File 'lib/holoserve/interface/control.rb', line 45

def state
  config[:state] ||= { }
end