Class: Gherkin::Lexer::Encoding
- Inherits:
-
Object
- Object
- Gherkin::Lexer::Encoding
- Defined in:
- lib/gherkin/lexer/encoding.rb
Constant Summary collapse
- COMMENT_OR_EMPTY_LINE_PATTERN =
/^\s*#|^\s*$/
- ENCODING_PATTERN =
:nodoc:
/^\s*#\s*encoding\s*:\s*([0-9a-zA-Z\-]+)/i
Instance Method Summary collapse
Instance Method Details
#read_file(path) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/gherkin/lexer/encoding.rb', line 9 def read_file(path) source = File.new(path).read enc = encoding(source) if(enc != 'UTF-8') # Read it again with different encoding source = File.new(path, "r:#{enc}:UTF-8").read end source end |