lib/spf/result.rb in spf-0.0.46 vs lib/spf/result.rb in spf-0.0.47

- old
+ new

@@ -2,11 +2,11 @@ require 'spf/model' require 'spf/util' class SPF::Result < Exception - attr_reader :server, :request + attr_reader :server, :request, :result_text class SPF::Result::Pass < SPF::Result def code :pass end @@ -61,13 +61,10 @@ class SPF::Result::NeutralByDefault < SPF::Result::Neutral # This is a special-case of the Neutral result that is thrown as a default # when "falling off" the end of the record. See SPF::Record.eval(). NAME = :neutral_by_default - def code - :neutral_by_default - end end class SPF::Result::None < SPF::Result def code :none @@ -131,32 +128,33 @@ end @request = args.shift if args.any? unless self.instance_variable_defined?(:@request) raise SPF::OptionRequiredError.new('Request object required') end + @result_text = args.shift if args.any? end def name return self.code end def klass(name=nil) if name name = name.to_sym if String === name - return self.RESULT_CLASSES[name] + return RESULT_CLASSES[name] else return name end end def isa_by_name(name) - suspect_class = self.klass(name) + suspect_class = self.klass(name.downcase) return false unless suspect_class return suspect_class === self end def is_code(code) - return self.isa_by_name(code) + return self.isa_by_name(code.downcase) end def to_s return sprintf('%s (%s)', self.name, SPF::Util.sanitize_string(super.to_s)) end