Sha256: 77980b4e8f4a21da3bf18976a2700831906f03fbfaa4fd5a87503f08f073c391

Contents?: true

Size: 546 Bytes

Versions: 12

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

module Humidifier
  # Dumps an object to CFN syntax
  class Serializer
    class << self
      # dumps the given object out to CFN syntax recursively
      def dump(node)
        case node
        when Hash    then node.map { |key, value| [key, dump(value)] }.to_h
        when Array   then node.map { |value| dump(value) }
        when Ref, Fn then dump(node.to_cf)
        when Date    then node.iso8601
        when Time    then node.to_datetime.iso8601
        else node
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
humidifier-4.0.2 lib/humidifier/serializer.rb
humidifier-4.0.1 lib/humidifier/serializer.rb
humidifier-4.0.0 lib/humidifier/serializer.rb
humidifier-3.5.0 lib/humidifier/serializer.rb
humidifier-3.4.0 lib/humidifier/serializer.rb
humidifier-3.3.0 lib/humidifier/serializer.rb
humidifier-3.2.0 lib/humidifier/serializer.rb
humidifier-3.1.0 lib/humidifier/serializer.rb
humidifier-3.0.1 lib/humidifier/serializer.rb
humidifier-3.0.0 lib/humidifier/serializer.rb
humidifier-2.15.0 lib/humidifier/serializer.rb
humidifier-2.6.0 lib/humidifier/serializer.rb