Module: Symbiont::Factory

Defined in:
lib/symbiont/factory.rb

Instance Method Summary collapse

Instance Method Details

#if_on(definition, &block) ⇒ Object



28
29
30
31
32
# File 'lib/symbiont/factory.rb', line 28

def if_on(definition, &block)
  definition = get_object_for(definition) if definition.is_a? String
  return @active unless @active.class == definition
  on(definition, false, &block)
end

#on(definition, visit = false, &block) ⇒ Object Also known as: during

Creates a definition context for actions.

definition

Parameters:

  • definition (Class)

    The name of a definition class

  • block (optional)

    Logic to execute within the context of the

Returns:

  • (Object)

    instance of the definition



10
11
12
13
14
15
# File 'lib/symbiont/factory.rb', line 10

def on(definition, visit=false, &block)
  definition = get_object_for(definition) if definition.is_a? String
  @active = definition.new(@browser, visit)
  block.call @active if block
  @active
end

#on_view(definition, &block) ⇒ Object Also known as: start_activity, start_on

Creates a definition context for actions and establishes the context for display.

definition

Parameters:

  • definition (Class)

    The name of a definition class

  • block (optional)

    Logic to execute within the context of the

Returns:

  • (Object)

    instance of the definition



24
25
26
# File 'lib/symbiont/factory.rb', line 24

def on_view(definition, &block)
  on(definition, true, &block)
end