Pardon the very basic question, but I’m not a Ruby programmer and I need to understand a line of Ruby code:
redirect to('/')
redirect is from Sinatra and I understand what it does, but ‘to’ is such a common word that however I try to Google this function, I can’t find it. Following modules are imported:
require 'cgi'
require 'sinatra'
require 'gollum'
require 'mustache/sinatra'
require 'useragent'
require 'stringex'
And in case it is needed, the whole file or some shorter one that I managed to find.
The method is
Sinatra::Helpers#uri, and it is aliased (also available) asurlandto. It creates an absolute url based on given arguments.So, nothing but a readable method name provided by Sinatra.