Class: Cucumber::Runtime::NormalisedEncodingFile
- Inherits:
-
Object
- Object
- Cucumber::Runtime::NormalisedEncodingFile
- Defined in:
- lib/cucumber/runtime.rb
Constant Summary collapse
- COMMENT_OR_EMPTY_LINE_PATTERN =
:nodoc:
/^\s*#|^\s*$/.freeze
- ENCODING_PATTERN =
:nodoc:
/^\s*#\s*encoding\s*:\s*([^\s]+)/.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ NormalisedEncodingFile
constructor
A new instance of NormalisedEncodingFile.
- #read ⇒ Object
Constructor Details
#initialize(path) ⇒ NormalisedEncodingFile
Returns a new instance of NormalisedEncodingFile.
160 161 162 163 164 165 166 167 |
# File 'lib/cucumber/runtime.rb', line 160 def initialize(path) @file = File.new(path) set_encoding rescue Errno::EACCES => e raise FileNotFoundException.new(e, File.(path)) rescue Errno::ENOENT raise FeatureFolderNotFoundException, path end |
Class Method Details
.read(path) ⇒ Object
156 157 158 |
# File 'lib/cucumber/runtime.rb', line 156 def self.read(path) new(path).read end |
Instance Method Details
#read ⇒ Object
169 170 171 |
# File 'lib/cucumber/runtime.rb', line 169 def read @file.read.encode('UTF-8') end |