Using Yaml
This Gem allows you to easily associate YAML files with classes
Installation
From Gemcutter:
sudo gem install using_yaml
Usage
require 'rubygems'
require 'using_yaml'
class ExampleUsage
include UsingYAML
using_yaml :some, :settings
end
example = ExampleUsage.new
# Load "OpenHash" from pathname.join('some.yml')
example.some #=> { "key" => "value" }
# Behaves like a normal hash
example.some['key'] #=> "value"
# AND like an object
example.some.key #=> "value"
# Setter methods work too
example.some.key = "another value"
# Saves to original location
example.save #=> writes
# .. and the same for settings
example.settings #=> "{ ... }"
Pathname
Coming soon!
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2010 Marc Bowes. See LICENSE for details.