class CloudFlare::DynamicDNS::ConfigParser
reads cloudflare-dynamic-dns config and converts into a Hash object.
Attributes
data[R]
Public Class Methods
new(data:)
click to toggle source
@param [String] data config file read as is from file system.
# File lib/cloud_flare/dynamic_dns/config_parser.rb, line 8 def initialize(data:) @data = data end
Public Instance Methods
execute()
click to toggle source
@return [Hash] k,v of configuration specified in cloudflare-dynamic-dns.conf
# File lib/cloud_flare/dynamic_dns/config_parser.rb, line 13 def execute items = data.chomp.split("\n").map { |item| item.split('=') } Hash[*items.flatten] end