Sha256: 1179afbc04866e16f940ad525e17c44f1f3d9d7d77847f742d857ac5115444a4

Contents?: true

Size: 799 Bytes

Versions: 5

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

require 'descriptive_statistics/safe'
require 'fileutils'
require 'launchy'
require 'tilt'

module Attractor
  # base reporter
  class BaseReporter
    extend Forwardable
    attr_accessor :values, :file_prefix
    def_delegator :@watcher, :watch

    def initialize(file_prefix: '')
      @file_prefix = file_prefix
      @calculator = Calculator.new(file_prefix: file_prefix)
      @values = @calculator.calculate
      @suggester = Suggester.new(values)

      @watcher = Watcher.new(file_prefix, lambda do
        report
      end)
    end

    def suggestions(quantile)
      @suggestions = @suggester.suggest(quantile)
      @suggestions
    end

    def report
      @suggestions = @suggester.suggest
    end

    def render
      'Attractor'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attractor-0.6.1 lib/attractor/reporters/base_reporter.rb
attractor-0.6.0 lib/attractor/reporters/base_reporter.rb
attractor-0.5.1 lib/attractor/reporters/base_reporter.rb
attractor-0.5.0 lib/attractor/reporters/base_reporter.rb
attractor-0.4.3 lib/attractor/reporters/base_reporter.rb