class Stockboy::Filters::MissingEmail
Very loose matching to pre-screen missing emails.
Only checks if there is a potential email-like string in the output value, and does not do any format checking for validity.
@example
filter = Stockboy::Filters::MissingEmail.new(:addr) model.email = "" filter.call(_, model) # => false model.email = "@" filter.call(_, model) # => true
Public Class Methods
new(attr)
click to toggle source
Initialize a new filter for a missing email attribute
@param [Symbol] attr
Name of the email attribute to examine on the mapped output record
# File lib/stockboy/filters/missing_email.rb, line 24 def initialize(attr) @attr = attr end
Private Instance Methods
filter(raw,output)
click to toggle source
# File lib/stockboy/filters/missing_email.rb, line 30 def filter(raw,output) value = output.send(@attr) return true if value.blank? return true unless value =~ /\w@\w/ end