Class: Contr::Matcher::Async

Inherits:
Base
  • Object
show all
Defined in:
lib/contr/matcher/async.rb

Instance Method Summary collapse

Constructor Details

#initializeAsync

Returns a new instance of Async.



6
7
8
9
10
11
12
# File 'lib/contr/matcher/async.rb', line 6

def initialize(*)
  super

  @async = true
  @ok_rules = Concurrent::Array.new
  @failed_rules = Concurrent::Array.new
end

Instance Method Details

#matchObject



14
15
16
17
18
19
20
21
22
# File 'lib/contr/matcher/async.rb', line 14

def match
  contract_future = main_pool.future do
    contract_failed = rules_pool ? check_with_async_rules : check_with_sync_rules

    dump_state! if contract_failed
  end

  contract_future.wait! if inline?
end