Class: Info::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/info/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorizerObject

Returns the value of attribute authorizer.



4
5
6
# File 'lib/info/configuration.rb', line 4

def authorizer
  @authorizer
end

#enabledObject

Returns the value of attribute enabled.



3
4
5
# File 'lib/info/configuration.rb', line 3

def enabled
  @enabled
end

Instance Method Details

#add(name, value) ⇒ Object



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

def add(name, value)
  collectors << {name: name, value: value}
end

#authorize(&block) ⇒ Object



16
17
18
# File 'lib/info/configuration.rb', line 16

def authorize(&block)
  @authorizer = block
end

#collect(request = nil) ⇒ Object



6
7
8
9
10
# File 'lib/info/configuration.rb', line 6

def collect(request = nil)
  collectors.each_with_object({}) do |collector, buffer|
    buffer[collector[:name]] = collect_value request, collector[:value]
  end
end

#collectorsObject



12
13
14
# File 'lib/info/configuration.rb', line 12

def collectors
  @collectors ||= []
end

#disable!Object



24
25
26
# File 'lib/info/configuration.rb', line 24

def disable!
  @enabled = false
end

#enable!Object



28
29
30
# File 'lib/info/configuration.rb', line 28

def enable!
  @enabled = true
end

#enabled?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/info/configuration.rb', line 20

def enabled?
  @enabled
end