Class: HostsFile::Parser

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/hosts_file/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Parser

Returns a new instance of Parser.



5
6
7
# File 'lib/hosts_file/parser.rb', line 5

def initialize(data)
  @data = data
end

Instance Method Details

#each(&block) ⇒ Object



9
10
11
12
13
14
# File 'lib/hosts_file/parser.rb', line 9

def each(&block)
  file_lines.each do |line|
    host = parse_line(line)
    yield(host) if host
  end
end