Sha256: 4fb5357383648ba0454d2f197da0ce72b0b8bce3b6ab658c6e1fd8b2e6b1a749

Contents?: true

Size: 381 Bytes

Versions: 8

Compression:

Stored size: 381 Bytes

Contents

require "rbfs/host"

module Rbfs
  class HostParser
    include Enumerable

    def initialize(file)
      @file = file
    end
    
    def each(&block)
      lines = @file.read.split("\n")
      lines.reject! {|line| line.strip.start_with? "#" }
      lines.reject! {|line| line.strip.empty? }
      lines.each do |line|
        yield(Host.new(line))
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rbfs-0.0.10 lib/rbfs/host_parser.rb
rbfs-0.0.9 lib/rbfs/host_parser.rb
rbfs-0.0.8 lib/rbfs/host_parser.rb
rbfs-0.0.7 lib/rbfs/host_parser.rb
rbfs-0.0.6 lib/rbfs/host_parser.rb
rbfs-0.0.5 lib/rbfs/host_parser.rb
rbfs-0.0.4 lib/rbfs/host_parser.rb
rbfs-0.0.3 lib/rbfs/host_parser.rb