File: //usr/local/rvm/gems/ruby-2.7.4/doc/concurrent-ruby-1.1.9/ri/Concurrent/Agent/new-c.ri
U:RDoc::AnyMethod[iI"new:ETI"Concurrent::Agent::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CCreate a new `Agent` with the given initial value and options.;To:RDoc::Markup::BlankLine o;
; [ I"MThe `:validator` option must be `nil` or a side-effect free proc/lambda ;TI"Nwhich takes one argument. On any intended value change the validator, if ;TI"Pprovided, will be called. If the new value is invalid the validator should ;TI"&return `false` or raise an error.;T@o;
; [
I"PThe `:error_handler` option must be `nil` or a proc/lambda which takes two ;TI"Narguments. When an action raises an error or validation fails, either by ;TI"Preturning false or raising an error, the error handler will be called. The ;TI"Parguments to the error handler will be a reference to the agent itself and ;TI"'the error object which was raised.;T@o;
; [I"JThe `:error_mode` may be either `:continue` (the default if an error ;TI"Khandler is given) or `:fail` (the default if error handler nil or not ;TI"given).;T@o;
; [
I"IIf an action being run by the agent throws an error or doesn't pass ;TI"Ivalidation the error handler, if present, will be called. After the ;TI"Ohandler executes if the error mode is `:continue` the Agent will continue ;TI"Nas if neither the action that caused the error nor the error itself ever ;TI"happened.;T@o;
; [ I"KIf the mode is `:fail` the Agent will become {#failed?} and will stop ;TI"Laccepting new action dispatches. Any previously queued actions will be ;TI"Kheld until {#restart} is called. The {#value} method will still work, ;TI"7returning the value of the Agent before the error.;T@o;
; [I"/@param [Object] initial the initial value ;TI"1@param [Hash] opts the configuration options;T@o;
; [I"E@option opts [Symbol] :error_mode either `:continue` or `:fail` ;TI"J@option opts [nil, Proc] :error_handler the (optional) error handler ;TI"L@option opts [nil, Proc] :validator the (optional) validation procedure;T:
@fileI",lib/concurrent-ruby/concurrent/agent.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(initial, opts = {});T@7TI"
Agent;TcRDoc::NormalClass00