Sha256: d4b62b8f8c670e1ee6c1db54f25cb102faf73e95fc98116a10f9dd5cad58fa0a
Contents?: true
Size: 850 Bytes
Versions: 1
Compression:
Stored size: 850 Bytes
Contents
module ErrandBoy module Validator class Base def initialize(request) @request = request end def run methods.each do |method| send(method) if /check_\w+/ === method end end def check_sender_name warn 'sender_name is empty.' if @request.sender['name'].empty? rescue NoMethodError warn 'sender does not set.' end def check_sender_email email = @request.sender['email'] if email.empty? warn 'sender_email is empty.' elsif email !~ valid_address warn 'sender_email is invalid address.' end rescue NoMethodError warn 'sender does not set.' end def valid_address %r(\A[a-zA-Z0-9_\#!$%&`'*+\-{|}~^\/=?\.]+@[a-zA-Z0-9][a-zA-Z0-9\.-]+\z) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
errand-boy-0.1.0 | lib/errand_boy/validator/base.rb |