class Coppertone::Modifier
Instances of this class represent modifier terms, as defined by the SPF specification (see section 4.6.1).
Constants
- MODIFIER_REGEXP
Attributes
arguments[R]
Public Class Methods
build(type, attributes)
click to toggle source
# File lib/coppertone/modifier.rb, line 9 def self.build(type, attributes) class_builder.build(type, attributes) end
build_unknown(type, attributes)
click to toggle source
# File lib/coppertone/modifier.rb, line 27 def self.build_unknown(type, attributes) Coppertone::Modifier::Unknown.new(type, attributes) end
class_builder()
click to toggle source
# File lib/coppertone/modifier.rb, line 5 def self.class_builder @class_builder ||= ClassBuilder.new end
matching_term(text)
click to toggle source
# File lib/coppertone/modifier.rb, line 18 def self.matching_term(text) matches = MODIFIER_REGEXP.match(text) return nil unless matches type = matches[1] attributes = matches[2] build(type, attributes) || build_unknown(type, attributes) end
new(arguments)
click to toggle source
# File lib/coppertone/modifier.rb, line 33 def initialize(arguments) @arguments = arguments end
register(klass)
click to toggle source
# File lib/coppertone/modifier.rb, line 13 def self.register(klass) class_builder.register(klass.label, klass) end
Public Instance Methods
label()
click to toggle source
# File lib/coppertone/modifier.rb, line 37 def label self.class.label end
to_s()
click to toggle source
# File lib/coppertone/modifier.rb, line 41 def to_s "#{label}=#{arguments}" end