class Coppertone::Mechanism
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
Attributes
arguments[R]
Public Class Methods
build(type, attributes)
click to toggle source
# File lib/coppertone/mechanism.rb, line 15 def self.build(type, attributes) class_builder.build(type, attributes) end
class_builder()
click to toggle source
# File lib/coppertone/mechanism.rb, line 11 def self.class_builder @class_builder ||= ClassBuilder.new end
dns_lookup_term?()
click to toggle source
# File lib/coppertone/mechanism.rb, line 25 def self.dns_lookup_term? false end
new(arguments)
click to toggle source
# File lib/coppertone/mechanism.rb, line 31 def initialize(arguments) @arguments = arguments end
register(klass)
click to toggle source
# File lib/coppertone/mechanism.rb, line 19 def self.register(klass) raise ArgumentError unless klass < self class_builder.register(klass.label, klass) end
Public Instance Methods
context_dependent?()
click to toggle source
# File lib/coppertone/mechanism.rb, line 44 def context_dependent? false end
dns_lookup_term?()
click to toggle source
# File lib/coppertone/mechanism.rb, line 35 def dns_lookup_term? self.class.dns_lookup_term? end
includes_ptr?()
click to toggle source
# File lib/coppertone/mechanism.rb, line 48 def includes_ptr? false end
to_s()
click to toggle source
# File lib/coppertone/mechanism.rb, line 39 def to_s mech_label = self.class.label arguments.blank? ? mech_label : "#{mech_label}#{arguments}" end