Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/hoe.rb
Class Method Summary collapse
-
.read_utf(path) ⇒ Object
Like File::read, but strips out a BOM marker if it exists.
Class Method Details
.read_utf(path) ⇒ Object
Like File::read, but strips out a BOM marker if it exists.
935 936 937 938 939 940 941 942 943 944 945 946 |
# File 'lib/hoe.rb', line 935 def self.read_utf path r19 = "<3".respond_to? :encoding opt = r19 ? "r:bom|utf-8" : "rb" open path, opt do |f| if r19 then f.read else f.read.sub %r%\A\xEF\xBB\xBF%, "" end end end |