Class: PrivatePlease::Tracking::Result
- Inherits:
-
Object
- Object
- PrivatePlease::Tracking::Result
- Defined in:
- lib/private_please/tracking/result.rb
Instance Method Summary collapse
-
#initialize(encountered_method_calls) ⇒ Result
constructor
A new instance of Result.
- #public_methods_only_called_privately ⇒ Object
- #to_two_level_hash ⇒ Object
Constructor Details
#initialize(encountered_method_calls) ⇒ Result
Returns a new instance of Result.
6 7 8 9 |
# File 'lib/private_please/tracking/result.rb', line 6 def initialize(encountered_method_calls) @private_calls = encountered_method_calls.private_calls @public_calls = encountered_method_calls.public_calls end |
Instance Method Details
#public_methods_only_called_privately ⇒ Object
11 12 13 |
# File 'lib/private_please/tracking/result.rb', line 11 def public_methods_only_called_privately @private_calls - @public_calls end |
#to_two_level_hash ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/private_please/tracking/result.rb', line 15 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 |