Adventure is an example gem. It was written as a demonstration for a presentation for Austin on Rails "How to Make A Ruby Gem".
Add this line to your application's Gemfile:
gem 'adventure'
And then execute:
$ bundle
Or install it yourself as:
$ gem install adventure
To use the gem:
- Require the gem:
require 'adventure'
- Make a new object:
plot = Adventure::Plot.new
- Call the make_plot method, passing in a JSON file with the plot elements.
plot.make_plot('adventure.json')
The JSON file should be structured as below. Each heading needs at least one item in the array.
{
"characters": [
"a clever dragon",
"a ruthless detective",
"a disgruntled shopkeeper",
"an aging cowboy",
"a grad student",
"a mystical lizard"
],
"with": [
"nothing left to loose",
"a secret past",
"an enchanted sword",
"a grudge",
"a knack for cooking"
],
"who": [
"likes kebabs",
"organizes poetry nights",
"is a world-famous cyclist",
"lived in a circus"
]
}