Generic Object Mapper - Filesystem adapter

The filesystem adapter for the Generic Object Mapper (github.com/phifty/gom) provides an easy way to store object data in the filesystem. Currently the adapter is read-only. The object data - stored in YML files - can be mapped to object, but no object data can be written to disk.

Configuration

If the adapter filesystem is chosen in the storage configuration, the following configuration values should specified.

  • directory - specifies to directory where the object data is placed in.

Example

GOM::Storage.configure {
  storage {
    name :storage_name
    adapter :filesystem
    directory "/var/project-name/data"
  }
}

Files

The adapter reads all the *.yml files in the specified directory. The basename of the file defines the class of the containing objects. A file can store multiple object of that class and is structured the following way.

# file Book.yml
book_1:
  properties:
    pages: 1253
  relations:
    author: author_1

# file Author.yml
author_1:
  properties:
    name: "Mr. Storyteller"

A fetch of that book would look like:

book = GOM::Storage.fetch "storage_name:book_1"

The fetched object would have the instance variable @pages set to 1253 and @author would point to an object of the class Author with the id author_1.

Views

This adapter currently supports class views. For documentation see github.com/phifty/gom.

Development

Development has been done test-driven and the code follows at most the Clean Code paradigms. Code smells has been removed by using the reek code smell detector.

This project is still experimental and under development. Any bug report and contribution is welcome!

Support

Apart from contribution, support via Flattr is welcome.