Class: Pact::ConsumerContract::Message::Contents
- Inherits:
-
Object
- Object
- Pact::ConsumerContract::Message::Contents
- Includes:
- ActiveSupportSupport, SymbolizeKeys
- Defined in:
- lib/pact/consumer_contract/message/contents.rb
Class Method Summary collapse
-
.from_hash(contents, options = {}) ⇒ Object
Could technically be an array.
Instance Method Summary collapse
- #as_json ⇒ Object
- #contents ⇒ Object
-
#initialize(contents) ⇒ Contents
constructor
A new instance of Contents.
- #to_s ⇒ Object
Constructor Details
#initialize(contents) ⇒ Contents
Returns a new instance of Contents.
13 14 15 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 13 def initialize contents @contents = contents end |
Class Method Details
.from_hash(contents, options = {}) ⇒ Object
Could technically be an array
9 10 11 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 9 def self.from_hash contents, = {} new(contents) end |
Instance Method Details
#as_json ⇒ Object
29 30 31 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 29 def as_json @contents end |
#contents ⇒ Object
25 26 27 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 25 def contents @contents end |
#to_s ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 17 def to_s if @contents.is_a?(Hash) || @contents.is_a?(Array) @contents.to_json else @contents.to_s end end |