Class: HttpStub::Server::Scenario::Scenario

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/server/scenario/scenario.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Scenario

Returns a new instance of Scenario.


9
10
11
12
13
14
15
16
# File 'lib/http_stub/server/scenario/scenario.rb', line 9

def initialize(hash)
  @args                     = hash
  @name                     = hash[:name]
  @links                    = HttpStub::Server::Scenario::Links.new(@name)
  @initially_activated_flag = hash[:activated]
  @stubs                    = create_stubs(hash[:stubs])
  @triggered_scenarios      = create_triggers(hash[:triggered_scenario_names])
end

Instance Attribute Details

Returns the value of attribute links


7
8
9
# File 'lib/http_stub/server/scenario/scenario.rb', line 7

def links
  @links
end

#nameObject (readonly)

Returns the value of attribute name


7
8
9
# File 'lib/http_stub/server/scenario/scenario.rb', line 7

def name
  @name
end

#stubsObject (readonly)

Returns the value of attribute stubs


7
8
9
# File 'lib/http_stub/server/scenario/scenario.rb', line 7

def stubs
  @stubs
end

#triggered_scenariosObject (readonly)

Returns the value of attribute triggered_scenarios


7
8
9
# File 'lib/http_stub/server/scenario/scenario.rb', line 7

def triggered_scenarios
  @triggered_scenarios
end

Instance Method Details

#initially_activated?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'lib/http_stub/server/scenario/scenario.rb', line 18

def initially_activated?
  !!@initially_activated_flag
end

#matches?(name, _logger) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/http_stub/server/scenario/scenario.rb', line 22

def matches?(name, _logger)
  @name == name
end

#to_sObject


26
27
28
# File 'lib/http_stub/server/scenario/scenario.rb', line 26

def to_s
  @args.to_s
end