Skip to content

Commit

Permalink
asm now takes a options hash
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Jan 26, 2011
1 parent 67448df commit b463064
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/convinius/asm.rb
Expand Up @@ -2,13 +2,14 @@ module Convinius
module ASM module ASM
extend self extend self


def asm(file = "(asm)", line = 1, method = :call, &block) def asm(opts = {}, &block)
code = Object.new object = opts[:object] || Object.new
Rubinius.object_metaclass(code).dynamic_method(method, file, line) do |g| opts = { :file => "(asm)", :line => 1, :method => :call }.merge! opts
Rubinius.object_metaclass(object).dynamic_method(opts[:method], opts[:file], opts[:line]) do |g|
block.arity > 0 ? yield(g) : g.instance_eval(&block) block.arity > 0 ? yield(g) : g.instance_eval(&block)
g.ret g.ret
end end
code object
end end


class << self class << self
Expand Down

0 comments on commit b463064

Please sign in to comment.