module LiveAST::Attacher

Constants

VAR_NAME

Public Instance Methods

attach_to_method(klass, method, ast) click to toggle source
# File lib/live_ast/linker.rb, line 29
def attach_to_method(klass, method, ast)
  unless klass.instance_variable_defined?(VAR_NAME)
    klass.instance_variable_set(VAR_NAME, {})
  end
  klass.instance_variable_get(VAR_NAME)[method] = ast
end
attach_to_proc(obj, ast) click to toggle source
# File lib/live_ast/linker.rb, line 21
def attach_to_proc(obj, ast)
  obj.instance_variable_set(VAR_NAME, ast)
end
fetch_method_attachment(klass, method) click to toggle source
# File lib/live_ast/linker.rb, line 36
def fetch_method_attachment(klass, method)
  if klass.instance_variable_defined?(VAR_NAME)
    klass.instance_variable_get(VAR_NAME)[method]
  end
end
fetch_proc_attachment(obj) click to toggle source
# File lib/live_ast/linker.rb, line 25
def fetch_proc_attachment(obj)
  obj.instance_variable_get(VAR_NAME) if obj.instance_variable_defined?(VAR_NAME)
end