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.



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

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



19
20
21
22
23
# File 'lib/browserctl/workflow.rb', line 19

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.



12
13
14
# File 'lib/browserctl/workflow.rb', line 12

def client
  @client
end

Instance Method Details

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

Raises:



39
40
41
# File 'lib/browserctl/workflow.rb', line 39

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

#invoke(workflow_name, **override_params) ⇒ Object



33
34
35
36
37
# File 'lib/browserctl/workflow.rb', line 33

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



29
30
31
# File 'lib/browserctl/workflow.rb', line 29

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

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

Returns:

  • (Boolean)


25
26
27
# File 'lib/browserctl/workflow.rb', line 25

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