タイトルの通り、HashをDSLで書けるDslhというGemを書きました。
https://bitbucket.org/winebarrel/dslh
使い方
require 'dslh' require 'pp' h = Dslh.eval do glossary do title "example glossary" GlossDiv do title "S" GlossList do GlossEntry do ID "SGML" SortAs "SGML" GlossTerm "Standard Generalized Markup Language" Acronym "SGML" Abbrev "ISO 8879:1986" GlossDef do para "A meta-markup language, used to create markup languages such as DocBook." GlossSeeAlso "GML", "XML" end GlossSee "markup" end end end end end pp h
# h => {:glossary=> {:title=>"example glossary", :GlossDiv=> {:title=>"S", :GlossList=> {:GlossEntry=> {:ID=>"SGML", :SortAs=>"SGML", :GlossTerm=>"Standard Generalized Markup Language", :Acronym=>"SGML", :Abbrev=>"ISO 8879:1986", :GlossDef=> {:para=> "A meta-markup language, used to create markup languages such as DocBook.", :GlossSeeAlso=>["GML", "XML"]}, :GlossSee=>"markup"}}}}}