summaryrefslogtreecommitdiff
path: root/lib/mailread.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mailread.rb')
-rw-r--r--lib/mailread.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mailread.rb b/lib/mailread.rb
index a5d60c8..5e46606 100644
--- a/lib/mailread.rb
+++ b/lib/mailread.rb
@@ -1,7 +1,7 @@
class Mail
def initialize(f)
- unless f.kind_of?(IO)
+ unless defined? f.gets
f = open(f, "r")
opened = true
end
@@ -15,7 +15,8 @@ class Mail
break if /^$/ # end of header
if /^(\S+):\s*(.*)/
- @header[attr = $1.capitalize!] = $2
+ (attr = $1).capitalize!
+ @header[attr] = $2
elsif attr
sub!(/^\s*/, '')
@header[attr] += "\n" + $_