class ArchSpec::Sources::Base
Shared interface for source adapters. Normalizes the file path, parses eagerly, and converts parser errors to ArchSpec source locations. Subclasses provide supported extensions, a Prism program, and comments.
Attributes
Public Class Methods
Source
# File lib/archspec/sources/base.rb, line 11 def self.extensions raise NotImplementedError end
Source
# File lib/archspec/sources/base.rb, line 21 def initialize(path) @path = File.expand_path(path) @result = parse_file end
Source
# File lib/archspec/sources/base.rb, line 15 def self.rubydex_indexable? false end
Public Instance Methods
Source
# File lib/archspec/sources/base.rb, line 26 def comments raise NotImplementedError end
Source
# File lib/archspec/sources/base.rb, line 34 def parse_errors result.errors.map do |error| ParseError.new(error.message, SourceLocation.from_prism(path, error.location)) end end
Source
# File lib/archspec/sources/base.rb, line 30 def prism raise NotImplementedError end