Class: WebConsole::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/web_console/context.rb

Overview

A context lets you get object names related to the current session binding.

Instance Method Summary collapse

Constructor Details

#initialize(binding) ⇒ Context

Returns a new instance of Context.



6
7
8
# File 'lib/web_console/context.rb', line 6

def initialize(binding)
  @binding = binding
end

Instance Method Details

#extract(input = nil) ⇒ Object

Extracts entire objects which can be called by the current session unless the inputs is present.

Otherwise, it extracts methods and constants of the object specified by the input.



15
16
17
# File 'lib/web_console/context.rb', line 15

def extract(input = nil)
  input.present? ? local(input) : global
end