Class: Cadence::ExecutionOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/cadence/execution_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, options = {}) ⇒ ExecutionOptions

Returns a new instance of ExecutionOptions.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cadence/execution_options.rb', line 7

def initialize(object, options = {})
  @name = options[:name] || object.to_s
  @domain = options[:domain]
  @task_list = options[:task_list]
  @retry_policy = options[:retry_policy]
  @cron_schedule = options[:cron_schedule]
  @timeouts = options[:timeouts] || {}
  @headers = options[:headers] || {}

  if object.singleton_class.included_modules.include?(Concerns::Executable)
    @domain ||= object.domain
    @task_list ||= object.task_list
    @retry_policy ||= object.retry_policy
    @timeouts = object.timeouts.merge(@timeouts) if object.timeouts
    @headers = object.headers.merge(@headers) if object.headers
  end

  @domain ||= Cadence.configuration.domain
  @task_list ||= Cadence.configuration.task_list
  @timeouts = Cadence.configuration.timeouts.merge(@timeouts)
  @headers = Cadence.configuration.headers.merge(@headers)

  freeze
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



5
6
7
# File 'lib/cadence/execution_options.rb', line 5

def domain
  @domain
end

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/cadence/execution_options.rb', line 5

def headers
  @headers
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/cadence/execution_options.rb', line 5

def name
  @name
end

#retry_policyObject (readonly)

Returns the value of attribute retry_policy.



5
6
7
# File 'lib/cadence/execution_options.rb', line 5

def retry_policy
  @retry_policy
end

#task_listObject (readonly)

Returns the value of attribute task_list.



5
6
7
# File 'lib/cadence/execution_options.rb', line 5

def task_list
  @task_list
end

#timeoutsObject (readonly)

Returns the value of attribute timeouts.



5
6
7
# File 'lib/cadence/execution_options.rb', line 5

def timeouts
  @timeouts
end