Sha256: cc0bd055e689951ec04fc603b80e0bb63e2eac63fd53a966a338c207ed57455a

Contents?: true

Size: 517 Bytes

Versions: 4

Compression:

Stored size: 517 Bytes

Contents

require 'sequel'
require 'sequel/plugins/serialization'


module PactBroker
  module Deployments
    class Environment < Sequel::Model
      OPEN_STRUCT_TO_JSON = lambda { |thing| Sequel.object_to_json(thing.collect(&:to_h)) }
      JSON_TO_OPEN_STRUCT = lambda { | json | Sequel.parse_json(json).collect{ | hash| OpenStruct.new(hash) } }
      plugin :upsert, identifying_columns: [:uuid]
      plugin :serialization
      serialize_attributes [OPEN_STRUCT_TO_JSON, JSON_TO_OPEN_STRUCT], :contacts
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/deployments/environment.rb
pact_broker-2.79.0 lib/pact_broker/deployments/environment.rb
pact_broker-2.78.1 lib/pact_broker/deployments/environment.rb
pact_broker-2.78.0 lib/pact_broker/deployments/environment.rb