Sha256: 3af8ce602e30c2319b8d0cb4c958fa98e67ee94b24b9654f720fc6d0187482d5

Contents?: true

Size: 297 Bytes

Versions: 2

Compression:

Stored size: 297 Bytes

Contents

# frozen_string_literal: true

module Structure
  module Utils
    def self.serialize(value)
      if value.respond_to?(:attributes)
        value.attributes
      elsif value.is_a?(::Array)
        value.map { |subvalue| serialize(subvalue) }
      else
        value
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
structure-1.1.1 lib/structure/utils.rb
structure-1.1.0 lib/structure/utils.rb