In ruby is there detailed documentation / information on how "<<" can and should be used (see exampl

Posted by kamal on Stack Overflow See other posts from Stack Overflow or by kamal
Published on 2010-06-09T17:01:44Z Indexed on 2010/06/09 17:02 UTC
Read the original article Hit count: 101

Filed under:

use a YML file, which has key , value pairs

yml_hosts = YAML::load(File.open('hosts.yml'))

.....

for each pair

yml_hosts.each_pair {|key_hosts , value_hosts|

......

redirect to a String "value_hosts"

value_hosts << "#{$.} #{line}" if line =~ /recoverable NFE/

Is there a better way of doing this, since i am using the condition:

if ! value_hosts.empty? to do an action, like sending email, etc but value_hosts is never Empty so i always get an email, even though, i ONLY want top get an email, if

line =~ /recoverable NFE/

© Stack Overflow or respective owner

Related posts about ruby