Class: Cucumberator::FeatureFile

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumberator/feature_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(scenario) ⇒ FeatureFile

Returns a new instance of FeatureFile.



3
4
5
# File 'lib/cucumberator/feature_file.rb', line 3

def initialize(scenario)
  @scenario = scenario
end

Instance Method Details

#append(contents) ⇒ Object



23
24
25
# File 'lib/cucumberator/feature_file.rb', line 23

def append(contents)
  File.open(file, 'a') { |f| f.puts(contents) }
end

#fileObject



11
12
13
# File 'lib/cucumberator/feature_file.rb', line 11

def file
  @feature_file ||= Pathname.new(@scenario.file_colon_line.split(":").first).realpath
end

#linesObject



7
8
9
# File 'lib/cucumberator/feature_file.rb', line 7

def lines
  File.readlines(file)
end

#overwrite(contents) ⇒ Object



19
20
21
# File 'lib/cucumberator/feature_file.rb', line 19

def overwrite(contents)
  File.open(file, 'w') { |f| f.puts(contents) }
end

#to_sObject



15
16
17
# File 'lib/cucumberator/feature_file.rb', line 15

def to_s
  File.basename(file)
end