class Cucumber::Runtime::NormalisedEncodingFile
Public Class Methods
new(path)
click to toggle source
# File lib/cucumber/runtime.rb, line 134 def initialize(path) begin @file = File.new(path) set_encoding rescue Errno::EACCES => e raise FileNotFoundException.new(e, File.expand_path(path)) rescue Errno::ENOENT => e raise FeatureFolderNotFoundException.new(e, path) end end
read(path)
click to toggle source
# File lib/cucumber/runtime.rb, line 130 def self.read(path) new(path).read end
Public Instance Methods
read()
click to toggle source
# File lib/cucumber/runtime.rb, line 145 def read @file.read.encode("UTF-8") end
Private Instance Methods
set_encoding()
click to toggle source
# File lib/cucumber/runtime.rb, line 151 def set_encoding @file.each do |line| if ENCODING_PATTERN =~ line @file.set_encoding $1 break end break unless COMMENT_OR_EMPTY_LINE_PATTERN =~ line end @file.rewind end