class SPF::Record::SPF::Record::SPF::Record::V1

Constants

MECH_CLASSES
MOD_CLASSES

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method
# File lib/spf/model.rb, line 1063
def initialize(options = {})
  super(options)

  @scopes ||= options[:scopes]
  if @scopes and scopes.any?
    unless @scopes.length > 0
      raise SPF::InvalidScopeError.new('No scopes for v=spf1 record')
    end
    if @scopes.length == 2
      unless (
          @scopes[0] == :helo  and @scopes[1] == :mfrom or
          @scopes[0] == :mfrom and @scopes[1] == :helo)
        raise SPF::InvalidScope.new(
          "Invalid set of scopes " + @scopes.map{|x| "'#{x}'"}.join(', ') + "for v=spf1 record")
      end
    end
  end
end
version_tag() click to toggle source
# File lib/spf/model.rb, line 1051
def self.version_tag
  'v=spf1'
end

Public Instance Methods

mech_classes() click to toggle source
# File lib/spf/model.rb, line 1059
def mech_classes
  MECH_CLASSES
end
scopes() click to toggle source
# File lib/spf/model.rb, line 1043
def scopes
  [:helo, :mfrom]
end
version_tag() click to toggle source
# File lib/spf/model.rb, line 1047
def version_tag
  'v=spf1'
end
version_tag_pattern() click to toggle source
# File lib/spf/model.rb, line 1055
def version_tag_pattern
  " v=spf(1) (?= \\x20+ | $ ) "
end