lib/dnsdeploy/local.rb in dnsdeploy-0.0.1 vs lib/dnsdeploy/local.rb in dnsdeploy-0.0.2
- old
+ new
@@ -1,11 +1,11 @@
require 'singleton'
module Dnsdeploy
class Local
- def initialize(records_file_path)
- @records_file_path = records_file_path
+ def initialize(local_records_json)
+ @local_records_json = local_records_json
end
def all_records
@all_records ||= json.map do |record_set|
domain = dnsimple_domain(record_set['zone'])
@@ -29,10 +29,10 @@
content: record['value'], ttl: record['ttl'], prio: record['prio'])
end
end
def json
- @json ||= JSON.load(@records_file_path.read)
+ @json ||= JSON.load(@local_records_json)
end
def dnsimple_domain(zone)
@dnsimple_domains ||= {}
@dnsimple_domains[zone] ||= DNSimple::Domain.all.select { |d| d.name == zone }.first