Class: Info::Configuration
- Inherits:
-
Object
- Object
- Info::Configuration
- Defined in:
- lib/info/configuration.rb
Instance Attribute Summary collapse
-
#authorizer ⇒ Object
Returns the value of attribute authorizer.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
Instance Method Summary collapse
- #add(name, value) ⇒ Object
- #authorize(&block) ⇒ Object
- #collect(request = nil) ⇒ Object
- #collectors ⇒ Object
- #disable! ⇒ Object
- #enable! ⇒ Object
- #enabled? ⇒ Boolean
Instance Attribute Details
#authorizer ⇒ Object
Returns the value of attribute authorizer.
4 5 6 |
# File 'lib/info/configuration.rb', line 4 def @authorizer end |
#enabled ⇒ Object
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 (&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 |
#collectors ⇒ Object
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
20 21 22 |
# File 'lib/info/configuration.rb', line 20 def enabled? @enabled end |