Module: ExecutionDeadline::Helpers

Defined in:
lib/execution_deadline/helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(mod) ⇒ Object



37
38
39
40
# File 'lib/execution_deadline/helpers.rb', line 37

def self.extended(mod)
  ExecutionDeadline::MethodProxy.for_class(mod.singleton_class)
  ExecutionDeadline::MethodProxy.for_class(mod)
end

Instance Method Details

#deadline(options = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/execution_deadline/helpers.rb', line 9

def deadline(options = {})
  options[:in] ||
    options[:runs_for] ||
    raise('expected deadline to include either :in or :runs_for')

  @last_deadline_config = options
end

#method_added(method_name) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/execution_deadline/helpers.rb', line 17

def method_added(method_name)
  super

  return unless _has_deadline_config?

  ExecutionDeadline::MethodProxy
    .for_class(self)
    .wrap_implementation(method_name, _fetch_and_reset_deadline_config)
end

#singleton_method_added(method_name) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/execution_deadline/helpers.rb', line 27

def singleton_method_added(method_name)
  super

  return unless _has_deadline_config?

  ExecutionDeadline::MethodProxy
    .for_class(singleton_class)
    .wrap_implementation(method_name, _fetch_and_reset_deadline_config)
end