Class: Metasploit::Yard::Aruba::RvmEnv::Export
- Defined in:
- lib/metasploit/yard/aruba/rvm_env/export.rb
Overview
Recognizes export
s of a variable
Direct Known Subclasses
Constant Summary collapse
- REGEXP =
Matches line with format
export <name>=<quote><value><quote>
/\Aexport (?<name>\S+?)(\s+;\s+\k<name>)?=(?<quote>"|')(?<value>.*?)\k<quote>\Z/
Instance Attribute Summary collapse
-
#value ⇒ String
The value to which Variable#name should be set.
Attributes inherited from Variable
Class Method Summary collapse
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Whether this export is the same class and has the same #value as
other
. -
#change(options = {}) ⇒ Object
Set Variable#name to #value.
-
#initialize(attributes = {}) ⇒ Export
constructor
A new instance of Export.
Constructor Details
#initialize(attributes = {}) ⇒ Export
Returns a new instance of Export.
48 49 50 51 52 53 |
# File 'lib/metasploit/yard/aruba/rvm_env/export.rb', line 48 def initialize(attributes={}) attributes.assert_valid_keys(:name, :value) super(name: attributes[:name]) @value = attributes[:value] end |
Instance Attribute Details
#value ⇒ String
The value to which Variable#name should be set
18 19 20 |
# File 'lib/metasploit/yard/aruba/rvm_env/export.rb', line 18 def value @value end |
Class Method Details
.parse(line) ⇒ Export?
Parses line of rvm env
output into an Metasploit::Yard::Aruba::RvmEnv::Export if it matches REGEXP.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/metasploit/yard/aruba/rvm_env/export.rb', line 29 def self.parse(line) # use self:: so subclasses can override match = self::REGEXP.match(line) if match new( name: match[:name], value: match[:value] ) end end |
Instance Method Details
#==(other) ⇒ true, false
Whether this export is the same class and has the same #value as other
.
59 60 61 |
# File 'lib/metasploit/yard/aruba/rvm_env/export.rb', line 59 def ==(other) super(other) && other.value == self.value end |
#change(options = {}) ⇒ Object
Set Variable#name to #value.
68 69 70 71 72 73 74 |
# File 'lib/metasploit/yard/aruba/rvm_env/export.rb', line 68 def change(={}) .assert_valid_keys(:from, :world) world = .fetch(:world) world.set_env(name, value) end |