Class: Coppertone::Mechanism::DomainSpecMechanism

Inherits:
Coppertone::Mechanism show all
Defined in:
lib/coppertone/mechanism/domain_spec_mechanism.rb

Overview

Parent class for mechanisms that use a domain spec.

Instance Attribute Summary collapse

Attributes inherited from Coppertone::Mechanism

#arguments

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Coppertone::Mechanism

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

Constructor Details

This class inherits a constructor from Coppertone::Mechanism

Instance Attribute Details

#domain_specObject (readonly)

Returns the value of attribute domain_spec.



5
6
7
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 5

def domain_spec
  @domain_spec
end

Class Method Details

.dns_lookup_term?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 21

def self.dns_lookup_term?
  true
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



43
44
45
46
47
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 43

def ==(other)
  return false unless other.instance_of? self.class

  domain_spec == other.domain_spec
end

#context_dependent?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 25

def context_dependent?
  return true unless domain_spec

  domain_spec.context_dependent?
end

#hashObject



50
51
52
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 50

def hash
  domain_spec.hash
end

#includes_ptr?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 31

def includes_ptr?
  return false unless domain_spec

  domain_spec.includes_ptr?
end

#target_domainObject



37
38
39
40
41
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 37

def target_domain
  raise Coppertone::NeedsContextError if context_dependent?

  domain_spec.to_s
end

#target_name_from_domain_spec(macro_context, request_context) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 7

def target_name_from_domain_spec(macro_context, request_context)
  if domain_spec
    domain =
      domain_spec.expand(macro_context, request_context)
  end
  Coppertone::Utils::DomainUtils.macro_expanded_domain(domain)
end

#trim_domain_spec(raw_domain_spec) ⇒ Object



15
16
17
18
19
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 15

def trim_domain_spec(raw_domain_spec)
  return nil if raw_domain_spec.blank?

  raw_domain_spec[1..]
end