Class: Uncov::Finder::Files
- Inherits:
-
Object
- Object
- Uncov::Finder::Files
- Defined in:
- lib/uncov/finder/files.rb
Overview
wrap finder results to have the same interface as finder
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
- #file?(file_name) ⇒ Boolean
- #file_names ⇒ Object
-
#initialize(files) ⇒ Files
constructor
A new instance of Files.
- #line(file_name, line_number) ⇒ Object
- #line?(file_name, line_number) ⇒ Boolean
- #lines(file_name) ⇒ Object
Constructor Details
#initialize(files) ⇒ Files
Returns a new instance of Files.
7 8 9 |
# File 'lib/uncov/finder/files.rb', line 7 def initialize(files) @files = files end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
5 6 7 |
# File 'lib/uncov/finder/files.rb', line 5 def files @files end |
Instance Method Details
#file?(file_name) ⇒ Boolean
11 12 13 |
# File 'lib/uncov/finder/files.rb', line 11 def file?(file_name) @files.key?(file_name) end |
#file_names ⇒ Object
15 16 17 |
# File 'lib/uncov/finder/files.rb', line 15 def file_names @files.keys end |
#line(file_name, line_number) ⇒ Object
23 24 25 |
# File 'lib/uncov/finder/files.rb', line 23 def line(file_name, line_number) @files.dig(file_name, line_number) end |
#line?(file_name, line_number) ⇒ Boolean
27 28 29 |
# File 'lib/uncov/finder/files.rb', line 27 def line?(file_name, line_number) lines(file_name)&.key?(line_number) end |
#lines(file_name) ⇒ Object
19 20 21 |
# File 'lib/uncov/finder/files.rb', line 19 def lines(file_name) @files[file_name] || {} end |