
Use blocks to quickly build out sub-mashes
Reported by Michael Bleigh | May 14th, 2008 @ 06:43 PM
From blog comment: A suggestion. You should be able to do something like this. conf = Mash.new() conf.tasklist do task1="some task" task2="some other task" end This would be more convenient that conf.tasklist.task1! = 'lll' conf.takslist.taks2! = '222'
Suggested API:
mash = Mash.new
mash.tasklist do |t|
t.task1 = "some task"
t.task2 = "something else"
end
mash.tasklist # => <Mash task1="some task" task2="something else">
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Mash is an extension of the Ruby Hash object to allow for pseudo-object syntax reminiscent of Javascript objects. It is useful for simple conversion of JSON or XML and also for configuration settings read from YAML.