Skip to content

Instantly share code, notes, and snippets.

@danhorst
Last active July 1, 2016 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danhorst/84382c6d4fecf4ae2a50301cf578e8b3 to your computer and use it in GitHub Desktop.
Save danhorst/84382c6d4fecf4ae2a50301cf578e8b3 to your computer and use it in GitHub Desktop.
Working with Locabulary

Working with Locabulary

Locabulary is a tool for naïve controlled vocabulary management. The data that locabulary draws upon is stored in JSON files in the data directory of the project.

Locabulary provides some convenience methods for accessing the data. It also returns data as objects that can be interrogated.

Setting up your development environment

Download the zip file of this gist and extract it.

Install ruby & project dependencies:

rbenv install `cat .ruby-version`
gem install bundler
bundle

Running the script

bundle exec ./demo.rb
#! /usr/bin/env ruby
require 'locabulary'
require 'logger'
logger = Logger.new(STDOUT)
logger.info('Loading values for administrative_units from Locabulary')
administrative_units = Locabulary.active_items_for(predicate_name: 'administrative_units')
administrative_units.each do |au|
logger.debug(au)
end
source 'https://rubygems.org'
gem 'locabulary', github: 'ndlib/locabulary', branch: 'master'
GIT
remote: git://github.com/ndlib/locabulary.git
revision: 999fa84b5bb3f973d71ac8a6a02e34bb2499ed36
branch: master
specs:
locabulary (0.4.0)
dry-configurable
hanami-utils
json (~> 1.8)
GEM
remote: https://rubygems.org/
specs:
concurrent-ruby (1.0.2)
dry-configurable (0.1.6)
concurrent-ruby (~> 1.0)
hanami-utils (0.7.2)
json (1.8.3)
PLATFORMS
ruby
DEPENDENCIES
locabulary!
BUNDLED WITH
1.12.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment