Class: HttpStub::Server::Stub::Response::Blocks

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

Instance Method Summary collapse

Constructor Details

#initialize(blocks) ⇒ Blocks

Returns a new instance of Blocks.



10
11
12
# File 'lib/http_stub/server/stub/response/blocks.rb', line 10

def initialize(blocks)
  @blocks = blocks || []
end

Instance Method Details

#evaluate_with(request) ⇒ Object



14
15
16
# File 'lib/http_stub/server/stub/response/blocks.rb', line 14

def evaluate_with(request)
  @blocks.reduce({}) { |result, block| result.deep_merge(call_block(block, request)) }
end

#to_arrayObject



18
19
20
# File 'lib/http_stub/server/stub/response/blocks.rb', line 18

def to_array
  @blocks.map(&:source)
end