KenLee is a Ruby Gem that aims to generate random data by using various web service APIs. This is a different strategy than what most random/fake data generators (e.g. Faker) employ.
Firstly, you need to include the Gem in your application. Since the Gem is not yet available on RubyGems, the easiest option is to do the following:
- Clone this Git repository somewhere onto your drive.
- Navigate to the Gem folder and execute:
gem build kenlee.gemspec- This will build you a
kenlee-x.y.z.gemGem file. - You can now install the Gem:
gem install ./kenlee-x.y.z.gem- Now, you can require the Gem from your application!
require 'kenlee'Currently, only one submodule for KenLee exists.
| Submodule | Description |
|---|---|
| WikiLee | Fetches random Wikipedia pages data. |
First, you need to initialize a WikiLee object with a specific Wikipedia language (it defaults to en):
wl = WikiLee.initialize(:en)To query random extract/s from Wikipedia pages:
text = wl.extract
texts = wl.extracts(15)To query random links from Wikipedia pages:
url = wl.link
urls = wl.links(8)