From: Zd Yu Date: 2010-12-20T16:22:15+09:00 Subject: How to implement such a Domain-Specific-Language (DSL)? I need to use Ruby to process performance data and calculate performance metrics. What I have is a Hash that contains event_name => event_value mappings. What I want to do is calculating metrics in a elegant style. for example: events = Hash.new # reading the raw data. # code omitted here. # now I get the basic events, like # events["event_A"] = 123.456 # events["event_B"] = 456.789 # the normal way looks like: events["metric_A"] = events["event_A"] * 64 / events["event_B"] # but what I am wondering if I can do it in an elegant way, like: metric_A = event_A * 64 / event_B Can anybody give some hints? -- Posted via http://www.ruby-forum.com/.