Class: HttpStub::Server::Stub::Triggers
- Inherits:
-
Object
- Object
- HttpStub::Server::Stub::Triggers
- Defined in:
- lib/http_stub/server/stub/triggers.rb
Constant Summary collapse
- EMPTY =
HttpStub::Server::Stub::Triggers.new.freeze
Instance Attribute Summary collapse
-
#scenario_names ⇒ Object
readonly
Returns the value of attribute scenario_names.
-
#stubs ⇒ Object
readonly
Returns the value of attribute stubs.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Triggers
constructor
A new instance of Triggers.
- #to_json(*args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Triggers
Returns a new instance of Triggers.
10 11 12 13 14 15 |
# File 'lib/http_stub/server/stub/triggers.rb', line 10 def initialize(args={}) resolved_args = { "scenario_names" => [], "stubs" => [] }.merge(args || {}) @scenario_names = resolved_args["scenario_names"] @stubs = resolved_args["stubs"].map { |stub_args| HttpStub::Server::Stub.create(stub_args) } @description = resolved_args.to_s end |
Instance Attribute Details
#scenario_names ⇒ Object (readonly)
Returns the value of attribute scenario_names.
7 8 9 |
# File 'lib/http_stub/server/stub/triggers.rb', line 7 def scenario_names @scenario_names end |
#stubs ⇒ Object (readonly)
Returns the value of attribute stubs.
8 9 10 |
# File 'lib/http_stub/server/stub/triggers.rb', line 8 def stubs @stubs end |
Instance Method Details
#to_json(*args) ⇒ Object
19 20 21 |
# File 'lib/http_stub/server/stub/triggers.rb', line 19 def to_json(*args) { scenario_names: @scenario_names, stubs: @stubs }.to_json(*args) end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/http_stub/server/stub/triggers.rb', line 23 def to_s @description end |