class Pact::ConsumerContract::Message::Contents

Public Class Methods

from_hash(contents, options = {}) click to toggle source

Could technically be an array

# File lib/pact/consumer_contract/message/contents.rb, line 10
def self.from_hash contents, options = {}
  new(contents)
end
new(contents) click to toggle source
# File lib/pact/consumer_contract/message/contents.rb, line 14
def initialize contents
  @contents = contents
end

Public Instance Methods

as_json() click to toggle source
# File lib/pact/consumer_contract/message/contents.rb, line 42
def as_json
  @contents
end
contents() click to toggle source
# File lib/pact/consumer_contract/message/contents.rb, line 38
def contents
  @contents
end
reified_contents_hash() click to toggle source
# File lib/pact/consumer_contract/message/contents.rb, line 34
def reified_contents_hash
  Pact::Reification.from_term(contents)
end
reified_contents_string() click to toggle source
# 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() click to toggle source
# 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