class Policial::Detective
Public: Starting with an Octokit client and a pull request, it checks all changes introduced looking for style guide violations.
Attributes
github_client[R]
pull_request[R]
violations[RW]
Public Class Methods
new(github_client = nil)
click to toggle source
# File lib/policial/detective.rb, line 10 def initialize(github_client = nil) @github_client = github_client || Octokit end
Public Instance Methods
brief(event_or_attributes)
click to toggle source
# File lib/policial/detective.rb, line 14 def brief(event_or_attributes) pull_request_attributes = extract_attributes(event_or_attributes) return unless pull_request_attributes @pull_request = PullRequest.new( pull_request_attributes.merge(github_client: @github_client) ) end
investigate(options = {})
click to toggle source
# File lib/policial/detective.rb, line 22 def investigate(options = {}) return unless pull_request @violations ||= StyleChecker.new(pull_request, options).violations end
Private Instance Methods
extract_attributes(event_or_attributes)
click to toggle source
# File lib/policial/detective.rb, line 29 def extract_attributes(event_or_attributes) if event_or_attributes.is_a?(PullRequestEvent) event_or_attributes.pull_request_attributes else event_or_attributes end end