Sha256: 722219c1e4beb5c4618482f63911ee5d6b8cde6030c9f6d2f9983f3f21b6b49c

Contents?: true

Size: 692 Bytes

Versions: 17

Compression:

Stored size: 692 Bytes

Contents

module DnsOne; module Backend; class File < Base

    def initialize file
        @domain_map = {}
        load file
    end

    def find dom_name
        @domain_map[dom_name.downcase]
    end

    def allow_cache
        false
    end

    private

    def load file
        ::File.open(file).each_line do |line|
            line.strip!
            domain_name, rec_set_name = line
                .split(/[,\s]+/)
            if domain_name and not domain_name.empty?
                @domain_map[domain_name.strip.downcase] = rec_set_name&.strip || ''
            else
                Global.logger.warn "Ignoring #{file} line: #{line}"
            end
        end
    end

end; end; end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dns_one-0.5.22 lib/dns_one/backend/file.rb
dns_one-0.5.21 lib/dns_one/backend/file.rb
dns_one-0.5.20 lib/dns_one/backend/file.rb
dns_one-0.5.19 lib/dns_one/backend/file.rb
dns_one-0.5.18 lib/dns_one/backend/file.rb
dns_one-0.5.17 lib/dns_one/backend/file.rb
dns_one-0.5.16 lib/dns_one/backend/file.rb
dns_one-0.5.15 lib/dns_one/backend/file.rb
dns_one-0.5.14 lib/dns_one/backend/file.rb
dns_one-0.5.13 lib/dns_one/backend/file.rb
dns_one-0.5.12 lib/dns_one/backend/file.rb
dns_one-0.5.11 lib/dns_one/backend/file.rb
dns_one-0.5.10 lib/dns_one/backend/file.rb
dns_one-0.5.9 lib/dns_one/backend/file.rb
dns_one-0.5.8 lib/dns_one/backend/file.rb
dns_one-0.5.7 lib/dns_one/backend/file.rb
dns_one-0.5.6 lib/dns_one/backend/file.rb