Public instance methods
erb
(request, template, headers={'Content-Type' => 'text/html'}, status=200)
Render ERB content
[show source]
# File lib/cloudkit/util.rb, line 5 5: def erb(request, template, headers={'Content-Type' => 'text/html'}, status=200) 6: template_file = open( 7: File.join(File.dirname(__FILE__), 8: 'templates', 9: "#{template.to_s}.erb")) 10: template = ERB.new(template_file.read) 11: result = template.result(binding) 12: Rack::Response.new(result, status, headers).finish 13: end
r
(method, path, params=[])
Build a Rack::Router instance
[show source]
# File lib/cloudkit/util.rb, line 16 16: def r(method, path, params=[]) 17: Rack::Router.new(method, path, params) 18: end
unquote
(text)
Remove the outer double quotes from a given string.
[show source]
# File lib/cloudkit/util.rb, line 21 21: def unquote(text) 22: (text =~ /^\".*\"$/) ? text[1..-2] : text 23: end