~singpolyma/dhall-ruby

7b768e2b0cd008c859b3274094d2b2c6b48fbc26 — Stephen Paul Weber 3 years ago ca1cda0 0.5.3
Fix map decode when transform_keys is not to_s
1 files changed, 2 insertions(+), 3 deletions(-)

M lib/dhall/coder.rb
M lib/dhall/coder.rb => lib/dhall/coder.rb +2 -3
@@ 105,12 105,11 @@ module Dhall

			refine List do
				def to_ruby(&decode)
					arr = to_a.map(&decode)
					unless element_type.is_a?(RecordType) &&
					       element_type.keys == ["mapKey", "mapValue"]
						return arr
						return to_a.map(&decode)
					end
					Hash[arr.map { |h| h.values_at("mapKey", "mapValue") }]
					Hash[to_a.map { |r| [r["mapKey"].to_s, decode[r["mapValue"]]] }]
				end
			end