Skip to content

Repository files navigation

TestsRuby Style Guide

pairtree

Ruby implementation of the Pairtree specification from the California Digital Library.

Installation

Add this line to your application's Gemfile:

gem'pairtree'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pairtree

Usage

require'pairtree'# Initiate a treepairtree=Pairtree.at('./data',:prefix=>'pfx:',:create=>true)# Create a ppathobj=pairtree.mk('pfx:abc123def')# Access an existing ppathobj=pairtree['pfx:abc123def']obj=pairtree.get('pfx:abc123def')# ppaths are Dir instances with some File and Dir class methods mixed inobj.read('content.xml')=>"<content/>"obj.open('my_file.txt','w'){ |io| io.write("Write text to file")}obj.entries=>["content.xml","my_file.txt"]obj['*.xml']=>["content.xml"]obj.each{ |file| ... }obj.unlink('my_file.txt')# Delete a ppath and all its contentspairtree.purge!('pfx:abc123def')

Copyright

Copyright (c) 2010 Chris Beer. See LICENSE.txt for further details.

About

Ruby Pairtree client

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages