Help Wanted - Chambermaid

Hi folks,

I’m working on a lib called Chambermaid that creates snapshots of ruby
objects and stores them in a git repository.

The main objective of Chambermaid is not to mess with your classes or
objects. Instead Chambermaid should provide a simple but powerful API.

You work with browsers which will give you access to specific diaries
(repos) and diaries which will give you access to specific pages
These pages contain snapshots of your ruby object.

Still neither documentation nor write support is available. I’m
struggling on how to snapshot files.

So here is my question:
Do you have an idea how I should treat files and other more complex

P.S.: Maybe at some point I can Chambermaid keep a diary on
herself… :smiley:



 require 'chambermaid'
 require 'person'

 PeopleBrowser = Chambermaid.browser Person # => a Browser
 foo_master_page = PeopleBrowser[1].last_page # => a Page
 person_foo = # => a Person

 # method missing binds a Context to the method called returning

the value
# returned by method ==


 class Person
   attr_accessor :id, :firstname, :lastname, :email

   # tell Chambermaid where to find the repositories
   Chambermaid.keed_diary self,
       :in => File.join(File.dirname(__FILE__), 'people'),
       :as => :id


 Chambermaid.ascribe Person do |has|
   # tell chambermaid where attributes should be read from and

write to

   # tell Chambermaid that the id is located in 'id.*' which reads
   # the value like:
   # 1. a Context tries to find the correct filename =>
   # 2. the filename is divided based on '.' => id, int, '1'
   # 3. the last n-1 parts are filters that manipulate the value

=> int, ‘1’
# 4. filters are applied in reverse order => ‘1’, int
# 5. unrecognized filters, like ‘1’, return itself as value =>
# 6. the int filter calls to_i on ‘1’ => 1
# 7. the result is assigned to the attribute id
has.attribute :id, ‘int.%i’, :id

   # tell Chambermaid the meta.yml file contains the

attributes :firstname and
# :lastname where .map adds the yml filter chain if not defined. :meta do |meta|
meta.reads(:firstname) { |meta| meta[‘firstname’] }
meta.reads(:lastname) { |meta| meta[‘lastname’] }

   has.attribute :email, 'uri'





 firstname: Foo
 lastname: Bar


 mailto:[email protected]

Florian Aßmann

Fork Unstable Media | Hamburg