Class: Ghn::Notification
- Inherits:
-
Object
- Object
- Ghn::Notification
- Defined in:
- lib/ghn/notification.rb
Direct Known Subclasses
CommitNotification, IssueNotification, PullRequestNotification, ReleaseNotification, UnknownNotification
Instance Attribute Summary collapse
-
#follow_issuecomment ⇒ Object
readonly
Returns the value of attribute follow_issuecomment.
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
Instance Method Summary collapse
-
#initialize(notification, follow_issuecomment) ⇒ Notification
constructor
A new instance of Notification.
- #type_class ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(notification, follow_issuecomment) ⇒ Notification
Returns a new instance of Notification.
5 6 7 8 |
# File 'lib/ghn/notification.rb', line 5 def initialize(notification, follow_issuecomment) @notification = notification @follow_issuecomment = follow_issuecomment end |
Instance Attribute Details
#follow_issuecomment ⇒ Object (readonly)
Returns the value of attribute follow_issuecomment.
3 4 5 |
# File 'lib/ghn/notification.rb', line 3 def follow_issuecomment @follow_issuecomment end |
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
3 4 5 |
# File 'lib/ghn/notification.rb', line 3 def notification @notification end |
Instance Method Details
#type_class ⇒ Object
10 11 12 13 14 15 |
# File 'lib/ghn/notification.rb', line 10 def type_class klass = "#{subject_type}Notification" Ghn.const_get(klass) rescue NameError Ghn::UnknownNotification end |
#url ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ghn/notification.rb', line 17 def url if follow_issuecomment && comment? "https://github.com/#{repo_full_name}/#{type}/#{thread_number}#issuecomment-#{comment_number}" else "https://github.com/#{repo_full_name}/#{type}/#{thread_number}" end end |