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
Instance methods
ast
Sourcecode
Sourcecorrect!
Corrects any correctable issues and updates code.
Returns false if no issues were corrected.
env
Sourcefullpath
Sourcelines
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"]
path
Sourcetemplate
Source