Class: Cucumber::Runtime::NormalisedEncodingFile

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/runtime.rb

Constant Summary collapse

COMMENT_OR_EMPTY_LINE_PATTERN =

:nodoc:

/^\s*#|^\s*$/
ENCODING_PATTERN =

:nodoc:

/^\s*#\s*encoding\s*:\s*([^\s]+)/

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ NormalisedEncodingFile

Returns a new instance of NormalisedEncodingFile



145
146
147
148
149
150
151
152
153
154
# File 'lib/cucumber/runtime.rb', line 145

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
    raise FeatureFolderNotFoundException.new(path)
  end
end

Class Method Details

.read(path) ⇒ Object



141
142
143
# File 'lib/cucumber/runtime.rb', line 141

def self.read(path)
  new(path).read
end

Instance Method Details

#readObject



156
157
158
# File 'lib/cucumber/runtime.rb', line 156

def read
  @file.read.encode('UTF-8')
end