Class: ChaosDetector::Stacker::FnInfo
- Defined in:
- lib/chaos_detector/stacker/fn_info.rb
Instance Attribute Summary
Attributes inherited from CompInfo
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #component_type ⇒ Object
- #fn_info ⇒ Object
-
#initialize(fn_name:, fn_line: nil, fn_path: nil) ⇒ FnInfo
constructor
A new instance of FnInfo.
- #to_s ⇒ Object
Methods inherited from CompInfo
Constructor Details
#initialize(fn_name:, fn_line: nil, fn_path: nil) ⇒ FnInfo
Returns a new instance of FnInfo.
10 11 12 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 10 def initialize(fn_name:, fn_line: nil, fn_path: nil) super(name: fn_name, path: fn_path, info: fn_line) end |
Class Method Details
.line_match?(l1, l2) ⇒ Boolean
36 37 38 39 40 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 36 def line_match?(l1, l2) return false if l1.nil? || l2.nil? (l2 - l1).between?(0, 1) end |
.match?(obj1, obj2, line_matching: false) ⇒ Boolean
31 32 33 34 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 31 def match?(obj1, obj2, line_matching: false) obj1.fn_path == obj2.fn_path && obj1.fn_name == obj2.fn_name # (obj1.fn_name == obj2.fn_name || line_match?(obj1.fn_line, obj2.fn_line)) end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 14 def ==(other) ChaosDetector::Stacker::FnInfo.match?(self, other) end |
#component_type ⇒ Object
26 27 28 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 26 def component_type :function end |
#fn_info ⇒ Object
18 19 20 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 18 def fn_info self end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/chaos_detector/stacker/fn_info.rb', line 22 def to_s "##{fn_name}: #{fn_path}:L#{fn_line}" end |