This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Mon Jun 30 22:30:10 -0700 2008 | |
| |
README.markdown | ||
| |
examples/ | ||
| |
lumberjack.rb | ||
| |
lumberjack_test.rb | ||
| |
rakefile.rb | Wed Dec 05 19:17:20 -0800 2007 |
README.markdown
Lumberjack is best summed up as a generic DSL for constructing object trees.
It works great for configuration files, for generating a tree of configuration objects for later reflection or what-not. But in reality you could use it for whatever you're willing to dream up.
I apologise for the lack of documentation :) Below is a code example to get you started, any questions, shoot me a message!
Now, that code example:
require 'lumberjack'
class Person
attr_accessor :age, :gripes, :chums
def initialize(name)
@name = name
@gripes = []
@chums = []
end
end
class Gripe
def initialize(desc)
@desc = desc
end
end
tree = Lumberjack.construct do
# we're in list / instanciate object scope
@john = person 'John (is a doondy head)' do
# we instanticated an object, so now we're in attr assignment scope
age 12 # this is equiv to @john.age = 12
gripes do # open up a colection on john...
# now we're back in list / instanticate object scope
gripe 'untested code' # creating a gripe
gripe 'no beer' # and another
end # out of gripes, back to john attr assignment
end # out of john
# we're back to creating people:
person 'Ryan' do
age 25
end
person 'Tim' do
age 'Infinite'
chums @john # instance vars are shared across Lumberjack.construct
end
end
puts tree.inspect








