module Atomy

Constants

Bootstrap
VERSION

Public Instance Methods

define_branch(binding, name, branch) click to toggle source
# File lib/atomy.rb, line 21
def define_branch(binding, name, branch)
  target =
    if branch.receiver
      branch.receiver.target
    else
      binding.lexical_scope.for_method_definition
    end

  method, branch = register_branch(target, name, branch)

  if branch.name
    Rubinius.add_method(branch.name, branch.as_method, target, binding.lexical_scope, 0, :public)
  end

  Rubinius.add_method(name, method.build, target, binding.lexical_scope, 0, :public)
end
register_branch(target, name, branch) click to toggle source
# File lib/atomy.rb, line 14
def register_branch(target, name, branch)
  methods = target.atomy_methods
  method = methods[name] ||= Atomy::Method.new(name)
  branch = method.add_branch(branch)
  [method, branch]
end