class Rookout::Processor::Namespaces::FrameNamespace

Public Class Methods

new(binding) click to toggle source
# File lib/rookout/processor/namespaces/frame_namespace.rb, line 10
def initialize binding
  @binding = binding
end

Public Instance Methods

call_method(name, args) click to toggle source
Calls superclass method
# File lib/rookout/processor/namespaces/frame_namespace.rb, line 20
def call_method name, args
  case name
  when "filename"
    RubyObjectNamespace.new @binding.source_location[0]
  when "line"
    RubyObjectNamespace.new @binding.source_location[1]
  when "function"
    RubyObjectNamespace.new @binding.eval("__method__").to_s
  when "module"
    RubyObjectNamespace.new @binding.source_location[0]
  when "locals"
    locals args
  when "dump"
    result = {
      "filename" => RubyObjectNamespace.new(@binding.source_location[0]),
      "line" => RubyObjectNamespace.new(@binding.source_location[1]),
      "function" => RubyObjectNamespace.new(@binding.eval("__method__").to_s),
      "module" => RubyObjectNamespace.new(@binding.source_location[0]),
      "locals" => locals(args)
    }
    ContainerNamespace.new result
  else
    super
  end
end
locals(args) click to toggle source
# File lib/rookout/processor/namespaces/frame_namespace.rb, line 46
def locals args
  dump_config = nil
  unless args.nil?
    dump_config = OBJECT_DUMP_TABLE[args.downcase]
  end

  hash = {}
  local_variables = @binding.local_variables
  local_variables.each do |var|
    value = @binding.local_variable_get var
    hash[var.to_s] = RubyObjectNamespace.new value, dump_config
  end

  hash["self"] = RubyObjectNamespace.new @binding.receiver, dump_config

  ContainerNamespace.new hash
end
read_attribute(name) click to toggle source
# File lib/rookout/processor/namespaces/frame_namespace.rb, line 14
def read_attribute name
  return RubyObjectNamespace.new @binding.receiver if name == "self"
  raise Exceptions::RookAttributeNotFound, name unless @binding.local_variable_defined? name
  RubyObjectNamespace.new @binding.local_variable_get name
end