Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Urban is a command line tool that allows you to look up definitions or pull a random definition from Urban Dictionary.

This branch is 63 commits behind tmiller:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
test
.gitignore
.travis.yml
Gemfile
HISTORY.rdoc
LICENSE
README.rdoc
Rakefile
urban.gemspec

README.rdoc

Urban

Urban is a command line tool that allows you to look up definitions or pull a random definition from Urban Dictionary.

Requirements

  • Ruby >= 1.8.6

Installation

With Rubygems:

$ sudo gem install urban

With git and local working copy

$ git clone git://github.com/tmiller/urban.git
$ cd urban
$ sudo rake install

CLI Usage

1. Look up a definition

$ urban cookie monster

2. Random definition

$ urban -r
$ urban --random

3. Print all definitons

$ urban -a cookie monster
$ urban -ra

4. Print the url of the definition at the end of the output

$ urban -u cookie monster
$ urban -ru

5. Print help and version

$ urban --help
$ urban --version

API Usage

requre 'urban'

# Search for a word
entry = Urban::Dictionary.search('impromtpu')

# Get a random word
entry = Urban::Dictionary.random

puts entry.phrase     # print the phrase
puts entry.url        # print the url of the phrase

# print all of the definitions
entry.definitions.each do |definition|
  puts definition
end

To Do

  • Add YARD documentation for API


Copyright © 2011 Thomas Miller. See LICENSE for details.

Something went wrong with that request. Please try again.