class GithubBot::Tasks::Base

Public: Base class for establishing tasks to be executed via a validator

Attributes

validator[R]

Public: Returns the validator associated to the task execution

Public Class Methods

new(validator) click to toggle source

Public: Initialize the task from a specific validator

@param validator [GithubBot::Validator::Base] An instance of the validator that is asking for the task

# File lib/github_bot/tasks/base.rb, line 13
def initialize(validator)
  @validator = validator
end

Private Instance Methods

client_api() click to toggle source

returns the github client api established either by the task or the validator

# File lib/github_bot/tasks/base.rb, line 34
def client_api
  # evaluate if the validator has defined the api and delegate accordingly
  return validator.client_api if validator.respond_to?(:client_api)

  ::GithubBot::Github::Client.instance
end
method_missing(method, *args, &block) click to toggle source

because tasks are executed by a validator, some methods are relayed across from the task back to the validator. this override checks for that existence

Calls superclass method
# File lib/github_bot/tasks/base.rb, line 21
def method_missing(method, *args, &block)
  return super unless respond_to_missing?(method)

  @validator.send(method, *args, &block)
end
respond_to_missing?(method, *args) click to toggle source

because tasks are executed by a validator, some methods are relayed across from the task back to the validator. this override checks for that existence

# File lib/github_bot/tasks/base.rb, line 29
def respond_to_missing?(method, *args)
  @validator.respond_to?(method, *args)
end