module Sisimai::Rhost
Sisimai::Rhost
detects the bounce reason from the content of Sisimai::Data
object as an argument of get() method when the value of rhost of the object is listed in the results of Sisimai::Rhost->list method. This class is called only Sisimai::Data
class.
Constants
- RhostClass
Imported from p5-Sisimail/lib/Sisimai/Rhost.pm
Public Class Methods
get(argvs, proxy = nil)
click to toggle source
Detect the bounce reason from certain remote hosts @param [Sisimai::Data] argvs Parsed email object @param [String] proxy The alternative of the “rhost” @return [String] The value of bounce reason
# File lib/sisimai/rhost.rb, line 50 def get(argvs, proxy = nil) remotehost = proxy || argvs.rhost.downcase rhostclass = '' modulename = '' RhostClass.each_key do |e| # Try to match with each key of RhostClass next unless remotehost.end_with?(e) modulename = 'Sisimai::Rhost::' << RhostClass[e] rhostclass = modulename.gsub('::', '/').downcase break end return nil if rhostclass.empty? require rhostclass reasontext = Module.const_get(modulename).get(argvs) return reasontext end
match(rhost)
click to toggle source
The value of “rhost” is listed in RhostClass
or not @param [String] argvs Remote host name @return [True,False] True: matched
False: did not match
# File lib/sisimai/rhost.rb, line 31 def match(rhost) return false if rhost.empty? host0 = rhost.downcase match = false RhostClass.each_key do |e| # Try to match with each key of RhostClass next unless host0.end_with?(e) match = true break end return match end