Class: Hookworm::GitHubPayloadAnnotator

Inherits:
Object
  • Object
show all
Defined in:
lib/hookworm/github_payload_annotator.rb

Constant Summary collapse

PULL_REQUEST_MESSAGE_RE =
/Merge pull request #[0-9]+ from.*/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cfg) ⇒ GitHubPayloadAnnotator

Returns a new instance of GitHubPayloadAnnotator.



9
10
11
# File 'lib/hookworm/github_payload_annotator.rb', line 9

def initialize(cfg)
  @cfg = cfg
end

Instance Attribute Details

#cfgObject (readonly)

Returns the value of attribute cfg.



5
6
7
# File 'lib/hookworm/github_payload_annotator.rb', line 5

def cfg
  @cfg
end

Instance Method Details

#annotate(payload) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/hookworm/github_payload_annotator.rb', line 13

def annotate(payload)
  payload.merge(
    is_pr_merge: pr_merge?(payload),
    is_watched_branch: watched_branch?(payload[:ref]),
    has_watched_path: watched_path?(payload)
  )
end