Class: HttpStub::Server::Stub::Triggers

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

Constant Summary collapse

EMPTY =
HttpStub::Server::Stub::Triggers.new.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Triggers

Returns a new instance of Triggers.


13
14
15
16
17
18
# File 'lib/http_stub/server/stub/triggers.rb', line 13

def initialize(args={})
  resolved_args   = DEFAULT_ARGS.merge(args || {})
  @scenario_names = resolved_args[:scenario_names]
  @stubs          = create_stubs(resolved_args[:stubs])
  @description    = resolved_args.to_s
end

Instance Attribute Details

#scenario_namesObject (readonly)

Returns the value of attribute scenario_names


11
12
13
# File 'lib/http_stub/server/stub/triggers.rb', line 11

def scenario_names
  @scenario_names
end

#stubsObject (readonly)

Returns the value of attribute stubs


11
12
13
# File 'lib/http_stub/server/stub/triggers.rb', line 11

def stubs
  @stubs
end

Instance Method Details

#to_json(*args) ⇒ Object


30
31
32
# File 'lib/http_stub/server/stub/triggers.rb', line 30

def to_json(*args)
  { scenario_names: @scenario_names, stubs: @stubs }.to_json(*args)
end

#to_sObject


34
35
36
# File 'lib/http_stub/server/stub/triggers.rb', line 34

def to_s
  @description
end