Sha256: 178dd7d289949f208db7582c8f7faeada504a22a12e32ddb0d8357fe91cd5186

Contents?: true

Size: 517 Bytes

Versions: 14

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true

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

    def initialize(file_path: '', churn: 1, complexity: 0)
      @file_path = file_path
      @churn = churn
      @complexity = complexity
    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 }
    end

    def to_json(_opt)
      to_h.to_json
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
attractor-0.4.3 lib/attractor/value.rb
attractor-0.4.2 lib/attractor/value.rb
attractor-0.4.1 lib/attractor/value.rb
attractor-0.4.0 lib/attractor/value.rb
attractor-0.3.4 lib/attractor/value.rb
attractor-0.3.3 lib/attractor/value.rb
attractor-0.3.2 lib/attractor/value.rb
attractor-0.3.1 lib/attractor/value.rb
attractor-0.3.0 lib/attractor/value.rb
attractor-0.2.1 lib/attractor/value.rb
attractor-0.2.0 lib/attractor/value.rb
attractor-0.1.2 lib/attractor/value.rb
attractor-0.1.1 lib/attractor/value.rb
attractor-0.1.0 lib/attractor/value.rb