Find file
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (43 sloc) 2 KB

Generic Object Mapper - Filesystem adapter

The filesystem adapter for the Generic Object Mapper ( 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.


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.


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


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
    pages: 1253
    author: author_1

# file Author.yml
    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.


This adapter currently supports class views. For documentation see


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!


Apart from contribution, support via Flattr is welcome.