Sha256: bb1150ee47917fb4b070c077574d52e3f0fd7f8bcfe7a900e860db071b143a77

Contents?: true

Size: 564 Bytes

Versions: 18

Compression:

Stored size: 564 Bytes

Contents

class Card
  module Env
    # serializing environment (eg for delayed jobs)
    module Serialization
      SERIALIZABLE_ATTRIBUTES = ::Set.new %i[
        main_name params ip ajax html host protocol salt
      ]

      # @param serialized_env [Hash]
      def with serialized_env
        tmp_env = serialize if @env
        @env ||= {}
        @env.update serialized_env
        yield
      ensure
        @env.update tmp_env if tmp_env
      end

      def serialize
        @env.select { |k, _v| SERIALIZABLE_ATTRIBUTES.include?(k) }
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
card-1.104.1 lib/card/env/serialization.rb
card-1.104.0 lib/card/env/serialization.rb
card-1.103.4 lib/card/env/serialization.rb
card-1.103.3 lib/card/env/serialization.rb
card-1.103.2 lib/card/env/serialization.rb
card-1.103.1 lib/card/env/serialization.rb
card-1.103.0 lib/card/env/serialization.rb
card-1.101.7 lib/card/env/serialization.rb
card-1.102.0 lib/card/env/serialization.rb
card-1.101.6 lib/card/env/serialization.rb
card-1.101.5 lib/card/env/serialization.rb
card-1.101.4 lib/card/env/serialization.rb
card-1.101.3 lib/card/env/serialization.rb
card-1.101.2 lib/card/env/serialization.rb
card-1.101.1 lib/card/env/serialization.rb
card-1.101.0 lib/card/env/serialization.rb
card-1.100.0 lib/card/env/serialization.rb
card-1.99.6 lib/card/env/serialization.rb