Class: Cucumberator::FeatureFile
- Inherits:
-
Object
- Object
- Cucumberator::FeatureFile
- Defined in:
- lib/cucumberator/feature_file.rb
Instance Method Summary collapse
- #append(contents) ⇒ Object
- #file ⇒ Object
-
#initialize(scenario) ⇒ FeatureFile
constructor
A new instance of FeatureFile.
- #lines ⇒ Object
- #overwrite(contents) ⇒ Object
- #to_s ⇒ Object
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 |
#file ⇒ Object
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 |
#lines ⇒ Object
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_s ⇒ Object
15 16 17 |
# File 'lib/cucumberator/feature_file.rb', line 15 def to_s File.basename(file) end |