class Pra::PullRequestService::FetchStatus

Attributes

error[R]
pull_requests[R]
status[R]

Public Class Methods

error(error) click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 10
def self.error(error)
  new(:error, :no_pull_requests, error)
end
new(status, pull_requests, error = nil) click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 14
def initialize(status, pull_requests, error = nil)
  @status = status
  @pull_requests = pull_requests
  @error = error
end
success(pull_requests) click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 6
def self.success(pull_requests)
  new(:success, pull_requests)
end

Public Instance Methods

error?() click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 32
def error?
  status == :error
end
on_error() { |error| ... } click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 24
def on_error &block
  yield(@error) if error?
end
on_success() { |pull_requests| ... } click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 20
def on_success &block
  yield(@pull_requests) if success?
end
success?() click to toggle source
# File lib/pra/pull_request_service/fetch_status.rb, line 28
def success?
  status == :success
end