Class: Coppertone::Mechanism::Include

Inherits:
DomainSpecRequired show all
Defined in:
lib/coppertone/mechanism/include.rb

Overview

Implements the include mechanism.

Instance Attribute Summary

Attributes inherited from DomainSpecMechanism

#domain_spec

Attributes inherited from Coppertone::Mechanism

#arguments

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DomainSpecRequired

create, #handle_invalid_domain, #initialize, #match?

Methods inherited from DomainSpecMechanism

#==, #context_dependent?, dns_lookup_term?, #hash, #includes_ptr?, #target_domain, #target_name_from_domain_spec, #trim_domain_spec

Methods inherited from Coppertone::Mechanism

build, class_builder, #context_dependent?, dns_lookup_term?, #dns_lookup_term?, #includes_ptr?, #initialize, register, #to_s

Constructor Details

This class inherits a constructor from Coppertone::Mechanism::DomainSpecRequired

Class Method Details

.labelObject



24
25
26
# File 'lib/coppertone/mechanism/include.rb', line 24

def self.label
  'include'
end

Instance Method Details

#context_for_include(macro_context, target_name) ⇒ Object



16
17
18
# File 'lib/coppertone/mechanism/include.rb', line 16

def context_for_include(macro_context, target_name)
  macro_context.with_domain(target_name)
end

#included_record(request_context, target_name) ⇒ Object



20
21
22
# File 'lib/coppertone/mechanism/include.rb', line 20

def included_record(request_context, target_name)
  RecordFinder.new(request_context.dns_client, target_name).record
end

#match_target_name(macro_context, request_context, target_name) ⇒ Object



9
10
11
12
13
14
# File 'lib/coppertone/mechanism/include.rb', line 9

def match_target_name(macro_context, request_context, target_name)
  record = included_record(request_context, target_name)
  IncludeMatcher.new(record)
                .match?(context_for_include(macro_context, target_name),
                        request_context)
end