Sha256: 5ffed5b3fa32295a33b44fa2924b1742e396f9aae22a8e6ff9276119f11fef85

Contents?: true

Size: 665 Bytes

Versions: 16

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

require 'json'

module Attractor
  # holds a churn/complexity value
  class Value
    attr_reader :file_path, :churn, :complexity, :details, :history

    def initialize(file_path: '', churn: 1, complexity: 0, details: [], history: [])
      @file_path = file_path
      @churn = churn
      @complexity = complexity
      @details = details
      @history = history
    end

    def to_s
      format('%-64s%8.1f%8i', @file_path, @complexity, @churn)
    end

    def to_h
      { file_path: file_path, x: churn, y: complexity, details: details, history: history }
    end

    def to_json(_opt)
      to_h.to_json
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
attractor-2.0.5 lib/attractor/value.rb
attractor-2.0.4 lib/attractor/value.rb
attractor-2.0.3 lib/attractor/value.rb
attractor-2.0.2 lib/attractor/value.rb
attractor-2.0.1 lib/attractor/value.rb
attractor-2.0.0 lib/attractor/value.rb
attractor-1.2.0 lib/attractor/value.rb
attractor-1.1.1 lib/attractor/value.rb
attractor-1.1.0 lib/attractor/value.rb
attractor-1.0.2 lib/attractor/value.rb
attractor-1.0.1 lib/attractor/value.rb
attractor-1.0.0 lib/attractor/value.rb
attractor-0.6.1 lib/attractor/value.rb
attractor-0.6.0 lib/attractor/value.rb
attractor-0.5.1 lib/attractor/value.rb
attractor-0.5.0 lib/attractor/value.rb