Class: Ronin::UI::Console::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/ui/console/context.rb

Overview

Since:

  • 1.2.0

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object

Catches missing constants and searches the Ronin namespace.

Parameters:

  • name (Symbol)

    The constant name.

Returns:

  • (Object)

    The found constant.

Raises:

  • (NameError)

    The constant could not be found within Ronin.

Since:

  • 1.0.0


55
56
57
# File 'lib/ronin/ui/console/context.rb', line 55

def self.const_missing(name)
  Ronin.send(:const_missing,name)
end

.inspectString

Inspects the console.

Returns:

  • (String)

    The inspected console.

Since:

  • 1.0.0


81
82
83
84
85
86
87
88
89
# File 'lib/ronin/ui/console/context.rb', line 81

def inspect
  body = unless instance_variables.empty?
           ': ' << instance_variables.map { |name|
             "#{name}=#{instance_variable_get(name).inspect}"
           }.join(', ')
         end

  return "#<Ronin::UI::Console#{body}>"
end

.instance_variables=(variables) ⇒ Object

Populates the instance variables.

Parameters:

  • variables (Hash)

    The variable names and values.

Since:

  • 1.2.0


65
66
67
68
69
# File 'lib/ronin/ui/console/context.rb', line 65

def instance_variables=(variables)
  variables.each do |name,value|
    instance_variable_set("@#{name}".to_sym,value)
  end
end

.newClass<Context>

Creates a new Ronin::UI::Console context.

Returns:

Since:

  • 1.2.0


34
35
36
# File 'lib/ronin/ui/console/context.rb', line 34

def self.new
  class << super; self; end
end