Class: Browserctl::WorkflowContext

Inherits:
Object
  • Object
show all
Defined in:
lib/browserctl/workflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, client) ⇒ WorkflowContext

Returns a new instance of WorkflowContext.



16
17
18
19
# File 'lib/browserctl/workflow.rb', line 16

def initialize(params, client)
  @params = params
  @client = client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



21
22
23
24
25
# File 'lib/browserctl/workflow.rb', line 21

def method_missing(name, *args)
  return @params[name] if @params.key?(name)

  super
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/browserctl/workflow.rb', line 14

def client
  @client
end

Instance Method Details

#assert(condition, msg = "assertion failed") ⇒ Object

Raises:



41
42
43
# File 'lib/browserctl/workflow.rb', line 41

def assert(condition, msg = "assertion failed")
  raise WorkflowError, msg unless condition
end

#invoke(workflow_name, **override_params) ⇒ Object



35
36
37
38
39
# File 'lib/browserctl/workflow.rb', line 35

def invoke(workflow_name, **override_params)
  name = workflow_name.to_s
  guard_circular!(name)
  track_invoke(name) { run_nested(workflow_name, **override_params) }
end

#page(name) ⇒ Object



31
32
33
# File 'lib/browserctl/workflow.rb', line 31

def page(name)
  PageProxy.new(name.to_s, @client)
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/browserctl/workflow.rb', line 27

def respond_to_missing?(name, include_private = false)
  @params.key?(name) || super
end