class

Ameba::Source

Inherits Ameba::Spec::Util < Ameba::Reportable < Ameba::InlineComments < Reference < Object

An entity that represents a Crystal source file. Has path, lines of code and issues reported by rules.

Constructors

new(env : Crinja, code : String, path : String)
Source
new(code : String, path : String, normalize : Bool) : self
Source
new(code : String = "", path : String = "")
Source

Instance methods

code
Source
correct!

Corrects any correctable issues and updates code. Returns false if no issues were corrected.

Source
fullpath
Source
lines

Returns lines of code split by new line character. Since code is immutable and can't be changed, this method caches lines in an instance variable, so calling it second time will not perform a split, but will return lines instantly.

source = Ameba::Source.new "a = 1\nb = 2", path
source.lines # => ["a = 1", "b = 2"]
Source
matches_path?(filepath)

Returns true if filepath matches the source's path, false otherwise.

Source
path
Source
template
Source
valid?

Returns true if the list of not disabled issues is empty, false otherwise.

Source

Nested types