Sha256: 8f46e1931089bf5cbf146a74a86f72a6f7833be291b8eb0fbf0c4f73f3ab756d

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

require 'private_please/tracking/method_details'

module PrivatePlease
  module Tracking
    class Result
      def initialize(encountered_method_calls)
        @private_calls = encountered_method_calls.private_calls
        @public_calls = encountered_method_calls.public_calls
      end

      def public_methods_only_called_privately
        @private_calls - @public_calls
      end

      def to_two_level_hash
        two_level_hash = Hash.new { |h, k| h[k] = {} }
        public_methods_only_called_privately.each do |class_plus_method|
          md = MethodDetails.from_class_plus_method(class_plus_method)
          two_level_hash[md.klass][md.separator_plus_method] = [md.source_path, md.lineno]
        end
        two_level_hash.delete_if { |_k, v| v.empty? }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
private_please-0.1.2 lib/private_please/tracking/result.rb
private_please-0.1.1 lib/private_please/tracking/result.rb
private_please-0.1.0 lib/private_please/tracking/result.rb