Class: HttpStub::Server::Stub::Match::Rule::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/server/stub/match/rule/body.rb

Class Method Summary collapse

Class Method Details

.create(body) ⇒ Object


9
10
11
12
13
14
15
16
17
# File 'lib/http_stub/server/stub/match/rule/body.rb', line 9

def self.create(body)
  if body.is_a?(Hash)
    HttpStub::Server::Stub::Match::Rule::SchemaBody.create(body.with_indifferent_access[:schema])
  elsif body.present?
    HttpStub::Server::Stub::Match::Rule::SimpleBody.new(body)
  else
    HttpStub::Server::Stub::Match::Rule::Truthy
  end
end