aderyabin/sniffer

Add block usage

aderyabin opened this issue · 2 comments

Add isolated usage support

sniffer = Sniffer.new do 
# some code here
end

sniffer.data

Hi Andrey, do you mean something like this?

class Sniffer
  def initialize
    @data = Data.new(singleton_config)

    Sniffer.enable!
    yield if block_given?
    ensure
      Sniffer.disable!
  end

  ...
end

With the singtone config instance but with separated instances for Sniffer.data

yes, you are right, I see it like that:

Sniffer.capture(config) do
# some code
end

And I thought about creating instances for Sniffer for with different configuration too.