class FuzzyGherkin::IO

Public Class Methods

new(base_step, similar_steps) click to toggle source

{

"base-step" : [
  "first.feature" : [
    "matching % - step that matches base"
  ],
  "second.feature" : [
    "matching % - step that matches base"
  ]
]

}

# File lib/fuzzy_gherkin/io.rb, line 14
def initialize(base_step, similar_steps)
    @base_step = base_step
    @similar_steps = similar_steps
end

Public Instance Methods

format_similar_steps_hash() click to toggle source
# File lib/fuzzy_gherkin/io.rb, line 19
def format_similar_steps_hash
  { @base_step => @similar_steps.uniq.sort.reverse }
end
write_results() click to toggle source
# File lib/fuzzy_gherkin/io.rb, line 23
def write_results
  file_name = 'results.json'
  f = File.new(file_name, 'w+')
  f.write(JSON.pretty_generate(format_similar_steps_hash))
  f.close
  puts "Writing results to file: #{file_name}"
end