public
Last active

  • Download Gist
ruby-search.ubiquity-command.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
CmdUtils.CreateCommand(
{
name: "ruby",
takes: {"function": noun_arb_text},
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://jackndempsey.blogspot.com",
author: {name: "Jack Dempsey", email: "jack.dempsey@gmail.com"},
license: "MPL,GPL",
description: "Search ruby functions documentation",
help: "Select a ruby function",
execute: function(directObject)
{
var url = "http://apidock.com/ruby/search?query={QUERY}&commit=Search"
var urlString = url.replace("{QUERY}", directObject.text);
Utils.openUrlInBrowser(urlString);
},
preview: function(pblock, directObject)
{
searchText = jQuery.trim(directObject.text);
if(searchText.length <= 0)
{
pblock.innerHTML = "Search ruby function documentation";
return;
}
var previewTemplate = "Search ruby function documentation of ${query}";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.