Module: Amass::Parsers::TXT

Defined in:
lib/amass/parsers/txt.rb

Overview

Parses single-line hostnames.

Class Method Summary collapse

Class Method Details

.parse(io) {|hostname| ... } ⇒ Enumerator

Parses a single line of plain-text.

Parameters:

  • io (IO)

    The IO stream to parse.

Yields:

  • (hostname)

    The given block will be passed each parsed hostname.

Yield Parameters:

  • hostname (Hostname)

    The parsed hostname.

Returns:

  • (Enumerator)

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



26
27
28
29
30
31
32
33
34
# File 'lib/amass/parsers/txt.rb', line 26

def self.parse(io)
  return enum_for(__method__,io) unless block_given?

  io.each_line do |line|
    line.chomp!

    yield Hostname.new(name: line)
  end
end