Class: Liveness::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/liveness/config.rb

Overview

Config of liveness

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container: Liveness.container, &block) ⇒ Liveness::Config

Since:

  • 0.1.0



17
18
19
20
21
22
23
# File 'lib/liveness/config.rb', line 17

def initialize(container: Liveness.container, &block)
  @container = container
  @dependencies = []
  @ip_whitelist = []

  instance_exec(self, &block) if defined?(yield)
end

Instance Attribute Details

#dependenciesObject (readonly)

Since:

  • 0.1.0



9
10
11
# File 'lib/liveness/config.rb', line 9

def dependencies
  @dependencies
end

#ip_whitelistObject

Since:

  • 0.3.0



12
13
14
# File 'lib/liveness/config.rb', line 12

def ip_whitelist
  @ip_whitelist
end

#tokenObject

Since:

  • 0.3.0



12
13
14
# File 'lib/liveness/config.rb', line 12

def token
  @token
end

Instance Method Details

#add(name, **options, &block) ⇒ Object

Add dependency config

Parameters:

  • name (Symbol)

    the dependency name

  • options (Hash)

    the dependency options

  • block (Proc)

    the block for config dependency

Since:

  • 0.1.0



32
33
34
35
36
37
# File 'lib/liveness/config.rb', line 32

def add(name, **options, &block)
  dependency = @container.create(name, **options, &block)
  return if dependency.nil?

  @dependencies << dependency
end