~singpolyma/dhall-ruby

4e99510ddbf71da33425db77b59f1a68c4e24445 — Stephen Paul Weber 2 years ago 786c022
More generic detection for association list
1 files changed, 4 insertions(+), 1 deletions(-)

M lib/dhall/coder.rb
M lib/dhall/coder.rb => lib/dhall/coder.rb +4 -1
@@ 106,7 106,10 @@ module Dhall
			refine List do
				def to_ruby(&decode)
					arr = to_a.map(&decode)
					return arr unless element_type == Types::MAP_ENTRY
					unless element_type.is_a?(RecordType) &&
					       element_type.keys == ["mapKey", "mapValue"]
						return arr
					end
					Hash[arr.map { |h| h.values_at("mapKey", "mapValue") }]
				end
			end