Skip to content

@benolee /yarv_dsl.rb secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
using RubyVM::InstructionSequence.disassemble for a DSL
def wat &block
method, receiver, *args = RubyVM::InstructionSequence.disassemble(block).scan(/send\s+:(\w+)/).reverse.flatten
{ receiver: receiver, method: method, args: args }
end
wat { (puts Kernel test (hello world)) }
#=> {:receiver=>"Kernel", :method=>"puts", :args=>["test", "hello", "world"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.