lib/rabbit/parser/rd.rb in rabbit-2.0.0 vs lib/rabbit/parser/rd.rb in rabbit-2.0.1
- old
+ new
@@ -16,10 +16,12 @@
class RD
push_loader(self)
class << self
def match?(source)
return true if /\A(?:rd|rab)\z/i =~ source.extension.to_s
- /^= /.match(source.read)
+ head = source.read[0, 500]
+ head.force_encoding("ASCII-8BIT") if head.respond_to?(:force_encoding)
+ /^= /.match(head)
end
end
def parse
source = @source.read.gsub(/\r\n/, "\n")