Class: GithubBot::Tasks::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/github_bot/tasks/base.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(validator) ⇒ Base

Public: Initialize the task from a specific validator

Parameters:



13
14
15
# File 'lib/github_bot/tasks/base.rb', line 13

def initialize(validator)
  @validator = validator
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)

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



21
22
23
24
25
# 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

Instance Attribute Details

#validatorObject (readonly)

Public: Returns the validator associated to the task execution



8
9
10
# File 'lib/github_bot/tasks/base.rb', line 8

def validator
  @validator
end