Class: TomogramRouting::Tomogram

Inherits:
Array
  • Object
show all
Defined in:
lib/tomogram_routing/tomogram.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.craft(docs) ⇒ Object



5
6
7
8
9
# File 'lib/tomogram_routing/tomogram.rb', line 5

def self.craft(docs)
  new(MultiJson.load(docs).inject([]) do |res, doc|
    res.push(Request.new.merge(doc))
  end)
end

Instance Method Details

#find_request(method:, path:) ⇒ Object



11
12
13
14
15
16
# File 'lib/tomogram_routing/tomogram.rb', line 11

def find_request(method:, path:)
  path = find_request_path(method: method, path: path)
  find do |doc|
    doc['path'] == path && doc['method'] == method
  end
end