Class: HttpStub::Server::Stub::Response::Attribute::Body
- Inherits:
-
String
- Object
- String
- HttpStub::Server::Stub::Response::Attribute::Body
- Defined in:
- lib/http_stub/server/stub/response/attribute/body.rb
Instance Method Summary collapse
-
#initialize(stub_body) ⇒ Body
constructor
A new instance of Body.
- #provided? ⇒ Boolean
- #with_values_from(request) ⇒ Object
Constructor Details
#initialize(stub_body) ⇒ Body
Returns a new instance of Body.
9 10 11 12 |
# File 'lib/http_stub/server/stub/response/attribute/body.rb', line 9 def initialize(stub_body) @stub_body = stub_body super stub_body.nil? ? "" : stub_body end |
Instance Method Details
#provided? ⇒ Boolean
22 23 24 |
# File 'lib/http_stub/server/stub/response/attribute/body.rb', line 22 def provided? !@stub_body.nil? end |
#with_values_from(request) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/http_stub/server/stub/response/attribute/body.rb', line 14 def with_values_from(request) if self.provided? HttpStub::Server::Stub::Response::Attribute::Interpolator.interpolate(@stub_body, request) else nil end end |