class Suspect::Storage::Reader

Attributes

base_path[R]
file_helper[R]

Public Class Methods

new(base_path, file_helper) click to toggle source
# File lib/suspect/storage/reader.rb, line 6
def initialize(base_path, file_helper)
  @base_path = base_path
  @file_helper = file_helper
end

Public Instance Methods

foreach() { |run_info_from(line)| ... } click to toggle source
# File lib/suspect/storage/reader.rb, line 11
def foreach
  run_info_paths.each do |path|
    file_helper.read(path) do |line|
      yield run_info_from(line)
    end
  end
end

Private Instance Methods

run_info_from(line) click to toggle source
# File lib/suspect/storage/reader.rb, line 27
def run_info_from(line)
  data = ::JSON.parse(line)
  run_info = ::Suspect::Gathering::RunInfo.new

  data.each_key do |k|
    run_info.public_send "#{k}=", data[k]
  end

  run_info
end
run_info_paths() click to toggle source
# File lib/suspect/storage/reader.rb, line 23
def run_info_paths
  file_helper.file_paths(base_path).select { |p| p.end_with?('.suspect') }
end