Project

rpairtree

0.0
Low commit activity in last 3 years
No release in over a year
rpairtree is deprecated; please use pairtree instead, which is now being maintained. rpairtree 0.3.0 and pairtree 0.3.0 are identical. There will be no further releases of rpairtree.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 3.12
>= 0
 Project Readme

Tests Coverage Status Ruby Style Guide

⚠️ Please use https://github.com/ruby-microservices/pairtree It is now being maintained again, so there is no need for this separate fork. pairtree 0.3.0 and rpairtree 0.3.0 are identical. This repository will be archived, and there will be no further releases of rpairtree.

rpairtree

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

Installation

Add this line to your application's Gemfile:

gem 'rpairtree'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rpairtree

Usage

  require 'pairtree'

  # Initiate a tree
  pairtree = Pairtree.at('./data', :prefix => 'pfx:', :create => true)
  
  # Create a ppath
  obj = pairtree.mk('pfx:abc123def')
  
  # Access an existing ppath
  obj = pairtree['pfx:abc123def']
  obj = pairtree.get('pfx:abc123def')
  
  # ppaths are Dir instances with some File and Dir class methods mixed in
  obj.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 contents
  pairtree.purge!('pfx:abc123def')

Copyright

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