Class: Ronin::Recon::InputFile

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/recon/input_file.rb

Overview

Represents an input file of values to recon.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ InputFile

Initializes the input file.

Parameters:

  • path (String)

    The input file path.



41
42
43
# File 'lib/ronin/recon/input_file.rb', line 41

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathString (readonly)

The path to the input file.

Returns:

  • (String)


33
34
35
# File 'lib/ronin/recon/input_file.rb', line 33

def path
  @path
end

Class Method Details

.open(path) ⇒ Object

Opens the input file.

Parameters:

  • path (String)

    The input file path.

See Also:



53
54
55
# File 'lib/ronin/recon/input_file.rb', line 53

def self.open(path)
  new(path)
end

Instance Method Details

#each {|value| ... } ⇒ Enumerator

Enumerates over every value in the input file.

Yields:

  • (value)

    If a block is given, it will be passed each parsed value.

Yield Parameters:

Returns:

  • (Enumerator)

    If no block is given, then an Enumerator will be returned.



69
70
71
72
73
74
75
76
77
# File 'lib/ronin/recon/input_file.rb', line 69

def each
  return enum_for unless block_given?

  File.open(@path) do |file|
    file.each_line(chomp: true) do |line|
      yield Value.parse(line)
    end
  end
end