Class: HttpStub::Server::Scenario::Instance
- Inherits:
-
Object
- Object
- HttpStub::Server::Scenario::Instance
- Defined in:
- lib/http_stub/server/scenario/instance.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#stubs ⇒ Object
readonly
Returns the value of attribute stubs.
-
#triggered_scenario_names ⇒ Object
readonly
Returns the value of attribute triggered_scenario_names.
Instance Method Summary collapse
-
#initialize(args) ⇒ Instance
constructor
A new instance of Instance.
- #satisfies?(name) ⇒ Boolean
- #to_s ⇒ Object
- #triggered_scenarios ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(args) ⇒ Instance
Returns a new instance of Instance.
9 10 11 12 13 14 |
# File 'lib/http_stub/server/scenario/instance.rb', line 9 def initialize(args) @args = args @name = @args["name"] @stubs = args["stubs"].map { |stub_args| HttpStub::Server::Stub.create(stub_args) } @triggered_scenario_names = @args["triggered_scenario_names"] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/http_stub/server/scenario/instance.rb', line 7 def name @name end |
#stubs ⇒ Object (readonly)
Returns the value of attribute stubs.
7 8 9 |
# File 'lib/http_stub/server/scenario/instance.rb', line 7 def stubs @stubs end |
#triggered_scenario_names ⇒ Object (readonly)
Returns the value of attribute triggered_scenario_names.
7 8 9 |
# File 'lib/http_stub/server/scenario/instance.rb', line 7 def triggered_scenario_names @triggered_scenario_names end |
Instance Method Details
#satisfies?(name) ⇒ Boolean
16 17 18 |
# File 'lib/http_stub/server/scenario/instance.rb', line 16 def satisfies?(name) @name == name end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/http_stub/server/scenario/instance.rb', line 28 def to_s @args.to_s end |
#triggered_scenarios ⇒ Object
24 25 26 |
# File 'lib/http_stub/server/scenario/instance.rb', line 24 def triggered_scenarios @triggered_scenario_names.reduce([]) { |result, name| result << [ name, "/#{name}" ] } end |
#uri ⇒ Object
20 21 22 |
# File 'lib/http_stub/server/scenario/instance.rb', line 20 def uri "/#{@name}" end |