aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/help.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/help.rb')
-rw-r--r--lib/irb/help.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/irb/help.rb b/lib/irb/help.rb
index 01e5878d18..2b064d5d6d 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -9,24 +9,27 @@
#
#
+require 'irb/magic-file'
+
module IRB
def IRB.print_usage
lc = IRB.conf[:LC_MESSAGES]
path = lc.find("irb/help-message")
space_line = false
- File.foreach(path) do
- |l|
- if /^\s*$/ =~ l
- lc.puts l unless space_line
- space_line = true
- next
+ IRB::MagicFile.open(path){|f|
+ f.each_line do |l|
+ if /^\s*$/ =~ l
+ lc.puts l unless space_line
+ space_line = true
+ next
+ end
+ space_line = false
+
+ l.sub!(/#.*$/, "")
+ next if /^\s*$/ =~ l
+ lc.puts l
end
- space_line = false
-
- l.sub!(/#.*$/, "")
- next if /^\s*$/ =~ l
- lc.puts l
- end
+ }
end
end