shard-ameba/src/ameba/source.cr

21 lines
424 B
Crystal
Raw Normal View History

2017-10-26 17:47:42 +00:00
module Ameba
class Source
2017-10-26 21:01:23 +00:00
record Error,
rule : String,
pos : Int32,
message : String
2017-10-26 17:47:42 +00:00
getter lines : Array(String)
2017-10-26 21:01:23 +00:00
getter errors = [] of Error
getter path : String
def initialize(@path : String)
@lines = File.read_lines(@path)
end
2017-10-26 17:47:42 +00:00
2017-10-26 21:01:23 +00:00
def error(rule, line_number : Int32, message : String)
errors << Error.new rule.class.name, line_number, message
2017-10-26 17:47:42 +00:00
end
end
end