Skip to content

Instantly share code, notes, and snippets.

@brixen
Created January 2, 2016 22:02
Show Gist options
  • Save brixen/1278cdaf01a2aa3f9d23 to your computer and use it in GitHub Desktop.
Save brixen/1278cdaf01a2aa3f9d23 to your computer and use it in GitHub Desktop.
$ rbx
irb(main):001:0> class A
irb(main):002:1> dynamic_method :hello do |g|
irb(main):003:2* g.push :self
irb(main):004:2> g.push_literal "ELLIOT!!!"
irb(main):005:2> g.send :puts, 1, true
irb(main):006:2> g.ret
irb(main):007:2> end
irb(main):008:1> end
=> #<Rubinius::CompiledCode hello file=(dynamic)>
irb(main):009:0> A.new.hello
ELLIOT!!!
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment