Sha256: bcd18b7a33e4e4c7abf9a407475f728003808833662e22766bf9efddf9ed2d13

Contents?: true

Size: 630 Bytes

Versions: 3

Compression:

Stored size: 630 Bytes

Contents

require 'pact/symbolize_keys'
module Pact

  # Specifies that the actual object should be considered a match if
  # it includes the same keys, and the values of the keys are of the same class.

  class SomethingLike
    include SymbolizeKeys

    attr_reader :contents

    def initialize contents
      @contents = contents
    end

    def as_json
      {
        :json_class => self.class.name,
        :contents => contents
      }
    end

    def to_json opts = {}
      as_json.to_json opts
    end

    def self.json_create hash
      new(symbolize_keys(hash))
    end

    def generate
      contents
    end
  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pact-1.0.12 lib/pact/something_like.rb
pact-1.0.11 lib/pact/something_like.rb
pact-1.0.10 lib/pact/something_like.rb