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)


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

def self.dns_lookup_term?
  true
end

Instance Method Details

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



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

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

#context_dependent?Boolean

Returns:

  • (Boolean)


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

def context_dependent?
  return true unless domain_spec
  domain_spec.context_dependent?
end

#hashObject



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

def hash
  domain_spec.hash
end

#includes_ptr?Boolean

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 29

def includes_ptr?
  return false unless domain_spec
  domain_spec.includes_ptr?
end

#target_domainObject



34
35
36
37
# File 'lib/coppertone/mechanism/domain_spec_mechanism.rb', line 34

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
# 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..-1]
end