Class: Ronin::Recon::Value
- Inherits:
-
Object
- Object
- Ronin::Recon::Value
- Defined in:
- lib/ronin/recon/value.rb,
lib/ronin/recon/value/parser.rb
Overview
Base class for all Values classes.
Direct Known Subclasses
Ronin::Recon::Values::Cert, Ronin::Recon::Values::EmailAddress, Ronin::Recon::Values::Host, Ronin::Recon::Values::IP, Ronin::Recon::Values::IPRange, Ronin::Recon::Values::OpenPort, Ronin::Recon::Values::URL, Ronin::Recon::Values::Website, Ronin::Recon::Values::Wildcard
Defined Under Namespace
Modules: Parser
Class Method Summary collapse
-
.parse(string) ⇒ Values::IP, ...
Parses a value string.
-
.value_type ⇒ Symbol
abstract
private
Returns the type or kind of recon value.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares the value to another value.
-
#as_json ⇒ Hash{Symbol => Object}
abstract
Coerces the value into JSON.
-
#to_csv ⇒ String
Converts the value to a CSV row.
-
#to_json(*args) ⇒ String
Converts the value into JSON.
-
#to_s ⇒ String
abstract
Converts the value to a String.
Class Method Details
.parse(string) ⇒ Values::IP, ...
Parses a value string.
107 108 109 |
# File 'lib/ronin/recon/value/parser.rb', line 107 def self.parse(string) Parser.parse(string) end |
.value_type ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is used internally to map a recon value class to a printable type.
Returns the type or kind of recon value.
44 45 46 |
# File 'lib/ronin/recon/value.rb', line 44 def self.value_type raise(NotImplementedError,"#{self}.value_type was not defined") end |
Instance Method Details
#==(other) ⇒ Boolean
Compares the value to another value.
57 58 59 |
# File 'lib/ronin/recon/value.rb', line 57 def ==(other) eql?(other) end |
#as_json ⇒ Hash{Symbol => Object}
Coerces the value into JSON.
69 70 71 |
# File 'lib/ronin/recon/value.rb', line 69 def as_json raise(NotImplementedError,"#{self.class}#as_json was not implemented") end |
#to_csv ⇒ String
Converts the value to a CSV row.
104 105 106 |
# File 'lib/ronin/recon/value.rb', line 104 def to_csv CSV.generate_line([self.class.value_type,to_s]) end |
#to_json(*args) ⇒ String
Converts the value into JSON.
94 95 96 |
# File 'lib/ronin/recon/value.rb', line 94 def to_json(*args) as_json.to_json(*args) end |
#to_s ⇒ String
Converts the value to a String.
81 82 83 |
# File 'lib/ronin/recon/value.rb', line 81 def to_s raise(NotImplementedError,"#{self.class}#to_s was not implemented") end |