A YAML files manager providing basic functionality of ActiveRecord.


Have you ever thought that YAML is better than XML? Have you ever considered making a database with yaml files? Now you can - the usage is simple as in ActiveRecord.


YAML::Adapter.initiate :directory => 'path_to_directory  # sets a path to directory with *.yml files
YAML::Adapter.entities                                   # returns an array of all objects

class Test < YAML::Record

test = Test.new
test.id                 # SHA1 id of an object
test.file_name          # name of the file that object can be saved to - "#{test.id}.yml"
test.save!              # serialises object to yaml format and saves in directory
test.destroy!           # removes file with an object from directory
Test.create             # creates a new object
Test.create!            # creates a new object and saves it in directory
Test.all                # returns an array of objects - instances of class Test
Test.find(id)           # returns an object with an id

Contributing to yaml_adapter

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Paweł Placzyński. See LICENSE for further details.