Class: MailLinks
Overview
show me the urls.
Constant Summary
Constants included from BasicLogging
BasicLogging::DEBUG, BasicLogging::ERROR, BasicLogging::FATAL, BasicLogging::INFO, BasicLogging::Levels, BasicLogging::UNKNOWN, BasicLogging::WARN
Instance Method Summary collapse
-
#initialize(mail = nil) ⇒ MailLinks
constructor
A new instance of MailLinks.
Methods included from BasicLogging
#clear_log, is_muted?, #level, #log, mute, #set_level, #set_target, #target
Constructor Details
#initialize(mail = nil) ⇒ MailLinks
Returns a new instance of MailLinks.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/maillinks.rb', line 27 def initialize(mail = nil) # a file may be piped in from the command-line... debug('parameter is ' << (mail ? mail : ' N I L' )) if(mail && '-' != mail.strip) msg = File_Checking.file_check(mail, :exist, :file, :readable) if(msg) error(yellow(msg) ) usage exit false else debug('will work on mail-file ' << mail) @mail = mail File::open(OUT_FILE, 'w+') {|of| of << File::read(@mail) } end elsif(!$<.eof?) info('Reading data from STDIN. Hit Ctrl+D to interrupt') input = $<.read debug('input length is ' << input.length.to_s) if(input.length < 10) error(yellow('insufficient input data')) error(yellow('No mail text provided')) usage() exit false end # ... provide a temporary file in that case, File.open(OUT_FILE, 'w+') {|of| of << input} @mail = OUT_FILE.dup debug('Temporary eml-file is written.') end procede end |