class Pronto::Message
Constants
- LEVELS
Attributes
commit_sha[R]
level[R]
line[R]
msg[R]
path[R]
runner[R]
Public Class Methods
new(path, line, level, msg, commit_sha = nil, runner = nil)
click to toggle source
# File lib/pronto/message.rb, line 7 def initialize(path, line, level, msg, commit_sha = nil, runner = nil) unless LEVELS.include?(level) raise ::ArgumentError, "level should be set to one of #{LEVELS}" end @path = path @line = line @level = level @msg = msg @runner = runner @commit_sha = commit_sha @commit_sha ||= line.commit_sha if line end
Public Instance Methods
==(other)
click to toggle source
# File lib/pronto/message.rb, line 29 def ==(other) comparison_attributes.all? do |attribute| send(attribute) == other.send(attribute) end end
Also aliased as: eql?
full_path()
click to toggle source
# File lib/pronto/message.rb, line 21 def full_path repo.path.join(path) if repo end
hash()
click to toggle source
# File lib/pronto/message.rb, line 37 def hash comparison_attributes.reduce(0) do |hash, attribute| hash ^ send(attribute).hash end end
repo()
click to toggle source
# File lib/pronto/message.rb, line 25 def repo line.patch.repo if line end
to_h()
click to toggle source
# File lib/pronto/message.rb, line 43 def to_h { path: path, line: line, level: level, msg: msg, commit_sha: commit_sha, runner: @runner && @runner.title } end
Private Instance Methods
comparison_attributes()
click to toggle source
# File lib/pronto/message.rb, line 56 def comparison_attributes line ? %i[path msg level line] : %i[path msg level commit_sha] end