0.01
No commit activity in last 3 years
No release in over 3 years
Interface to urbandictionary.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.4
~> 1.22.6

Runtime

~> 1.5
 Project Readme

Urban Dictionary

urban_dictionary is a Ruby gem to access word definitions and examples from Urban Dictionary. It also provides a command-line tool for getting definitions.

Build Status

Installation

Run gem install urban_dictionary.

Usage

Get words using UrbanDictionary.define or UrbanDictionary.random_word. These methods return an instance of UrbanDictionary::Word, which has a list of entries, or nil if the word is not found. Each entry has a definition and an example.

require 'urban_dictionary'

word = UrbanDictionary.define("QED")
word.entries.size # => 7
word.entries.each do |entry|
  puts entry.definition
  puts entry.example
end

Command Line

The urban_dictionary gem includes a command-line interface:

> urban_dictionary super salad
super salad
-----------

1. A mythical dish of the best salad ever compiled
...
...

You can use the --random flag to get the definition of random word:

> urban_dictionary --random

Specify the output format with --format. The default is plain; json is also supported.

> urban_dictionary --format=json one hundred | jq .
{
  "word": "one hundred",
  "entries": [
    {
      "definition": "keepin it real to the fullest and super tight.",
      "example": "end of the convo\nLuke: aight man, peace\nQ: kool homie, keep it one hundred (100)"
    },
    ...
}

Tests

Run examples with:

rspec