Minidsl
Minidsl is an DSL way to generate mainly codes.
$: << "lib"
require 'minidsl'
include Minidsl
r = Scope.push_context :Statements
class Test
def int(opt = {})
opt.map{|k, v|
"int #{k} = #{v};"
}
end
def println(str)
"System.out.println(#{str.inspect});"
end
end
s = pure_proxy Test.new
s.instance_eval{
int a: 3, b: 5
println "Hello world"
}
puts r.resultwould generate
int a = 3;
int b = 5;
System.out.println("Hello world");Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/RGSS3/minidsl.
License
The gem is available as open source under the terms of the MIT License.