Class: ResolverReplace

Inherits:
Object
  • Object
show all
Defined in:
lib/resolver_replace.rb,
lib/resolver_replace/error.rb

Defined Under Namespace

Classes: PluginLoadError

Class Method Summary collapse

Class Method Details

.error_classObject


23
24
25
# File 'lib/resolver_replace.rb', line 23

def self.error_class
  @error_class
end

.getaddress(host) ⇒ Object


15
16
17
# File 'lib/resolver_replace.rb', line 15

def self.getaddress(host)
  @getaddress.call(host)
end

.getaddresses(host) ⇒ Object


19
20
21
# File 'lib/resolver_replace.rb', line 19

def self.getaddresses(host)
  @getaddresses.call(host)
end

.load_plugin(name) ⇒ Object


27
28
29
# File 'lib/resolver_replace.rb', line 27

def self.load_plugin(name)
  require "resolver_replace/plugins/#{name}"
end

.register!(params = {}) ⇒ Object


4
5
6
7
8
9
10
11
12
13
# File 'lib/resolver_replace.rb', line 4

def self.register!(params = {})
  unless @getaddress = params[:getaddress]
    raise ArgumentError, 'getaddress is required'
  end
  unless @getaddresses = params[:getaddresses]
    raise ArgumentError, 'getaddresses is required'
  end
  @error_class = params[:error_class] || StandardError
  require 'resolver_replace/replace.rb'
end