Module: Rubydex::Linter::Helpers::SourceAccessHelpers

Included in:
Rules::RuleStructure
Defined in:
lib/rubydex/linter/helpers/source_access_helpers.rb

Overview

File and URI access for linter rules.

Instance Method Summary collapse

Instance Method Details

#file_location(uri) ⇒ Object

: (String) -> Location



9
10
11
# File 'lib/rubydex/linter/helpers/source_access_helpers.rb', line 9

def file_location(uri)
  Location.new(uri: uri, start_line: 0, end_line: 0, start_column: 0, end_column: 0)
end

#path_for_uri(uri) ⇒ Object

: (String) -> String



14
15
16
17
18
# File 'lib/rubydex/linter/helpers/source_access_helpers.rb', line 14

def path_for_uri(uri)
  file_location(uri).to_file_path
rescue Location::NotFileUriError
  uri
end