Class: Pronto::Message
- Inherits:
-
Object
- Object
- Pronto::Message
- Defined in:
- lib/pronto/message.rb
Constant Summary collapse
- LEVELS =
[:info, :warning, :error, :fatal]
Instance Attribute Summary collapse
-
#commit_sha ⇒ Object
readonly
Returns the value of attribute commit_sha.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(path, line, level, msg, commit_sha = nil) ⇒ Message
constructor
A new instance of Message.
- #repo ⇒ Object
Constructor Details
#initialize(path, line, level, msg, commit_sha = nil) ⇒ Message
Returns a new instance of Message.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pronto/message.rb', line 7 def initialize(path, line, level, msg, commit_sha = nil) unless LEVELS.include?(level) raise ::ArgumentError, "level should be set to one of #{LEVELS}" end @path = path @line = line @level = level @msg = msg @commit_sha = commit_sha @commit_sha ||= line.commit_sha if line end |
Instance Attribute Details
#commit_sha ⇒ Object (readonly)
Returns the value of attribute commit_sha.
3 4 5 |
# File 'lib/pronto/message.rb', line 3 def commit_sha @commit_sha end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
3 4 5 |
# File 'lib/pronto/message.rb', line 3 def level @level end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
3 4 5 |
# File 'lib/pronto/message.rb', line 3 def line @line end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
3 4 5 |
# File 'lib/pronto/message.rb', line 3 def msg @msg end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/pronto/message.rb', line 3 def path @path end |
Instance Method Details
#full_path ⇒ Object
20 21 22 |
# File 'lib/pronto/message.rb', line 20 def full_path repo.path.join(path) if repo end |
#repo ⇒ Object
24 25 26 |
# File 'lib/pronto/message.rb', line 24 def repo line.patch.repo if line end |