Class: Sunzi::DNS

Inherits:
Object
  • Object
show all
Includes:
Utility
Defined in:
lib/sunzi.rb,
lib/sunzi/dns.rb,
lib/sunzi/dns/base.rb,
lib/sunzi/dns/linode.rb,
lib/sunzi/dns/route53.rb

Defined Under Namespace

Classes: Base, Linode, Route53

Instance Method Summary collapse

Methods included from Utility

#abort_with, #exit_with, #say

Constructor Details

#initialize(config, cloud) ⇒ DNS

Returns a new instance of DNS.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/sunzi/dns.rb', line 5

def initialize(config, cloud)
  dns = config['dns']
  @subject = case dns
  when 'linode'
    Sunzi::DNS::Linode.new(config, cloud)
  when 'route53'
    Sunzi::DNS::Route53.new(config, cloud)
  else
    abort_with "DNS #{dns} is not valid!"
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



17
18
19
# File 'lib/sunzi/dns.rb', line 17

def method_missing(sym, *args, &block)
  @subject.send sym, *args, &block
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/sunzi/dns.rb', line 21

def respond_to?(method)
  @subject.respond_to?(sym) || super
end