Module: CedarPolicy

Defined in:
lib/cedar_policy.rb,
lib/cedar_policy/entity.rb,
lib/cedar_policy/context.rb,
lib/cedar_policy/version.rb,
lib/cedar_policy/entities.rb,
lib/cedar_policy/entity_uid.rb,
sig/cedar_policy.rbs

Overview

:nodoc:

Defined Under Namespace

Classes: Context, Entities, Entity, EntityUid, Error

Constant Summary collapse

VERSION =

Returns:

  • (String)
"0.7.1"

Class Method Summary collapse

Class Method Details

.deep_serialize(input) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cedar_policy.rb', line 23

def self.deep_serialize(input)
  input.to_hash.each_with_object({}) do |(key, value), output|
    output[key.to_sym] =
      case value
      when ->(h) { h.respond_to?(:to_hash) } then deep_serialize(value)
      when Array
        value.map { |item| item.respond_to?(:to_hash) ? deep_serialize(item) : item }
      else
        value
      end
  end
end