Class: Metasploit::Yard::Aruba::RvmEnv::Unset

Inherits:
Variable
  • Object
show all
Defined in:
lib/metasploit/yard/aruba/rvm_env/unset.rb

Overview

Recognizes unsets of environment variables.

Constant Summary collapse

REGEXP =

Matches line with format unset <name>

/\Aunset (?<name>.*?)\Z/

Instance Attribute Summary

Attributes inherited from Variable

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Variable

#==, #initialize

Constructor Details

This class inherits a constructor from Metasploit::Yard::Aruba::RvmEnv::Variable

Class Method Details

.parse(line) ⇒ Unset?

Parses lines of rvm env output into a Prepend if it matches REGEXP

Parameters:

  • line (String)

    a line of rvm env output.

Returns:

  • (Unset)

    if line contains unset.

  • (nil)

    otherwise



19
20
21
22
23
24
25
26
27
# File 'lib/metasploit/yard/aruba/rvm_env/unset.rb', line 19

def self.parse(line)
  match = REGEXP.match(line)

  if match
    new(
        name: match[:name]
    )
  end
end

Instance Method Details

#change(options = {}) ⇒ Object

Unsets Variable#name.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

Options Hash (options):



38
39
40
41
42
43
# File 'lib/metasploit/yard/aruba/rvm_env/unset.rb', line 38

def change(options={})
  options.assert_valid_keys(:from , :world)

  world = options.fetch(:world)
  world.unset_env(name)
end