Module: Hubkit::Configuration

Defined in:
lib/hubkit/configuration.rb

Overview

Hold the configuration of the Hubkit library. Holds the client, default github organization, and the github library configuration options.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientGithub::Client

The underlying Github::Client that will be used for library operations


32
33
34
# File 'lib/hubkit/configuration.rb', line 32

def client
  @client || Github.new
end

.default_orgObject

Returns the value of attribute default_org


13
14
15
# File 'lib/hubkit/configuration.rb', line 13

def default_org
  @default_org
end

.github_configObject

Returns the value of attribute github_config


14
15
16
# File 'lib/hubkit/configuration.rb', line 14

def github_config
  @github_config
end

Class Method Details

.configure(opts = {}) {|this| ... } ⇒ Github::Client

Set configuration for the library

Yield Parameters:


21
22
23
24
25
26
27
# File 'lib/hubkit/configuration.rb', line 21

def configure(opts = {}, &block)
  hubkit_config = self
  @client = Github.new do |github_config|
    hubkit_config.github_config = github_config
    yield hubkit_config
  end
end

.method_missing(name, *args) {|...| ... } ⇒ Object

Pass through all method calls which are not implemented directly on the Configuration to the client's configuration method

Yield Parameters:

  • ...

    any arguments to the block required by the underlying Github::Client method


43
44
45
46
47
48
# File 'lib/hubkit/configuration.rb', line 43

def method_missing(name, *args, &block)
  if github_config.present? && github_config.respond_to?(name, false)
    return github_config.public_send(name, *args, &block)
  end
  super
end