class HttpStub::Server::Scenario::Scenario
Attributes
links[R]
name[R]
stubs[R]
triggered_scenarios[R]
Public Class Methods
new(hash)
click to toggle source
# 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
Public Instance Methods
initially_activated?()
click to toggle source
# File lib/http_stub/server/scenario/scenario.rb, line 18 def initially_activated? !!@initially_activated_flag end
matches?(name, _logger)
click to toggle source
# File lib/http_stub/server/scenario/scenario.rb, line 22 def matches?(name, _logger) @name == name end
to_s()
click to toggle source
# File lib/http_stub/server/scenario/scenario.rb, line 26 def to_s @args.to_s end
Private Instance Methods
create_stubs(stub_hashes)
click to toggle source
# File lib/http_stub/server/scenario/scenario.rb, line 32 def create_stubs(stub_hashes) stub_hashes.map { |hash| HttpStub::Server::Stub.create(hash) } end
create_triggers(scenario_names)
click to toggle source
# File lib/http_stub/server/scenario/scenario.rb, line 36 def create_triggers(scenario_names) scenario_names.map { |scenario_name| HttpStub::Server::Scenario::Trigger.new(scenario_name) } end