Class: Coppertone::Mechanism
- Inherits:
-
Object
- Object
- Coppertone::Mechanism
show all
- Defined in:
- lib/coppertone/mechanism.rb,
lib/coppertone/mechanism/a.rb,
lib/coppertone/mechanism/mx.rb,
lib/coppertone/mechanism/all.rb,
lib/coppertone/mechanism/ip4.rb,
lib/coppertone/mechanism/ip6.rb,
lib/coppertone/mechanism/ptr.rb,
lib/coppertone/mechanism/exists.rb,
lib/coppertone/mechanism/include.rb,
lib/coppertone/mechanism/cidr_parser.rb,
lib/coppertone/mechanism/ip_mechanism.rb,
lib/coppertone/mechanism/include_matcher.rb,
lib/coppertone/mechanism/domain_spec_optional.rb,
lib/coppertone/mechanism/domain_spec_required.rb,
lib/coppertone/mechanism/domain_spec_mechanism.rb,
lib/coppertone/mechanism/domain_spec_with_dual_cidr.rb
Overview
The class itself is primarily used as a factory for creating concrete mechanism instances based on a mechanism type string and corresponding attribute string. Validation of the type is done here, while validation of the attributes is delegated to the class corresponding to the mechanism type
Defined Under Namespace
Classes: A, All, CidrParser, DomainSpecMechanism, DomainSpecOptional, DomainSpecRequired, DomainSpecWithDualCidr, Exists, IP4, IP6, IPMechanism, Include, IncludeMatcher, MX, Ptr
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(arguments) ⇒ Mechanism
Returns a new instance of Mechanism.
31
32
33
|
# File 'lib/coppertone/mechanism.rb', line 31
def initialize(arguments)
@arguments = arguments
end
|
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
29
30
31
|
# File 'lib/coppertone/mechanism.rb', line 29
def arguments
@arguments
end
|
Class Method Details
.build(type, attributes) ⇒ Object
15
16
17
|
# File 'lib/coppertone/mechanism.rb', line 15
def self.build(type, attributes)
class_builder.build(type, attributes)
end
|
.class_builder ⇒ Object
11
12
13
|
# File 'lib/coppertone/mechanism.rb', line 11
def self.class_builder
@class_builder ||= ClassBuilder.new
end
|
.dns_lookup_term? ⇒ Boolean
25
26
27
|
# File 'lib/coppertone/mechanism.rb', line 25
def self.dns_lookup_term?
false
end
|
.register(klass) ⇒ Object
19
20
21
22
23
|
# File 'lib/coppertone/mechanism.rb', line 19
def self.register(klass)
raise ArgumentError unless klass < self
class_builder.register(klass.label, klass)
end
|
Instance Method Details
#context_dependent? ⇒ Boolean
44
45
46
|
# File 'lib/coppertone/mechanism.rb', line 44
def context_dependent?
false
end
|
#dns_lookup_term? ⇒ Boolean
35
36
37
|
# File 'lib/coppertone/mechanism.rb', line 35
def dns_lookup_term?
self.class.dns_lookup_term?
end
|
#includes_ptr? ⇒ Boolean
48
49
50
|
# File 'lib/coppertone/mechanism.rb', line 48
def includes_ptr?
false
end
|
#to_s ⇒ Object
39
40
41
42
|
# File 'lib/coppertone/mechanism.rb', line 39
def to_s
mech_label = self.class.label
arguments.blank? ? mech_label : "#{mech_label}#{arguments}"
end
|