Class: Coppertone::RedirectRecordFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/coppertone/redirect_record_finder.rb

Overview

A helper class for finding SPF records for a redirect modifier.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(redirect, macro_context, request_context) ⇒ RedirectRecordFinder

Returns a new instance of RedirectRecordFinder.



5
6
7
8
9
# File 'lib/coppertone/redirect_record_finder.rb', line 5

def initialize(redirect, macro_context, request_context)
  @redirect = redirect
  @macro_context = macro_context
  @request_context = request_context
end

Instance Attribute Details

#macro_contextObject (readonly)

Returns the value of attribute macro_context.



4
5
6
# File 'lib/coppertone/redirect_record_finder.rb', line 4

def macro_context
  @macro_context
end

#redirectObject (readonly)

Returns the value of attribute redirect.



4
5
6
# File 'lib/coppertone/redirect_record_finder.rb', line 4

def redirect
  @redirect
end

#request_contextObject (readonly)

Returns the value of attribute request_context.



4
5
6
# File 'lib/coppertone/redirect_record_finder.rb', line 4

def request_context
  @request_context
end

Instance Method Details

#recordObject



15
16
17
18
# File 'lib/coppertone/redirect_record_finder.rb', line 15

def record
  return unless target
  @record ||= RecordFinder.new(request_context.dns_client, target).record
end

#targetObject



11
12
13
# File 'lib/coppertone/redirect_record_finder.rb', line 11

def target
  @redirect_target ||= redirect.evaluate(macro_context, request_context)
end