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.
- #reified_contents_string ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(contents) ⇒ Contents
Returns a new instance of Contents.
14 15 16 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 14 def initialize contents @contents = contents end |
Class Method Details
.from_hash(contents, options = {}) ⇒ Object
Could technically be an array
10 11 12 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 10 def self.from_hash contents, = {} new(contents) end |
Instance Method Details
#as_json ⇒ Object
38 39 40 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 38 def as_json @contents end |
#contents ⇒ Object
34 35 36 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 34 def contents @contents end |
#reified_contents_string ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 26 def reified_contents_string if contents.is_a?(Hash) || contents.is_a?(Array) Pact::Reification.from_term(contents).to_json else Pact::Reification.from_term(contents).to_s end end |
#to_s ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/pact/consumer_contract/message/contents.rb', line 18 def to_s if contents.is_a?(Hash) || contents.is_a?(Array) contents.to_json else contents.to_s end end |