Class: Muffler::Config
- Inherits:
-
Object
- Object
- Muffler::Config
- Defined in:
- lib/muffler/config.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#ips ⇒ Object
Returns the value of attribute ips.
-
#mufflers ⇒ Object
Returns the value of attribute mufflers.
-
#paths ⇒ Object
Returns the value of attribute paths.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #muffle_with(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/muffler/config.rb', line 5 def initialize @header = 'HTTP_X_MUFFLE_LOGGER' # send in header as X-Muffle-Logger @ips = [] @paths = [] @mufflers = {} muffle_with(:header) { |opts| !opts[@header].nil? } muffle_with(:ip) { |opts| @ips.any? { |ip| ip === opts['REMOTE_ADDR'] } } muffle_with(:path) { |opts| @paths.any? { |path| path === opts['PATH_INFO'] } } end |
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
3 4 5 |
# File 'lib/muffler/config.rb', line 3 def header @header end |
#ips ⇒ Object
Returns the value of attribute ips.
3 4 5 |
# File 'lib/muffler/config.rb', line 3 def ips @ips end |
#mufflers ⇒ Object
Returns the value of attribute mufflers.
3 4 5 |
# File 'lib/muffler/config.rb', line 3 def mufflers @mufflers end |
#paths ⇒ Object
Returns the value of attribute paths.
3 4 5 |
# File 'lib/muffler/config.rb', line 3 def paths @paths end |
Instance Method Details
#muffle_with(name, &block) ⇒ Object
16 17 18 |
# File 'lib/muffler/config.rb', line 16 def muffle_with(name, &block) @mufflers[name] = block end |