~singpolyma/dhall-ruby

13a2e30a9d0359bb6308626db9eb3132c3bbf058 — Stephen Paul Weber 10 months ago 4efa09c master 0.5.7
Allow custom timeout with dhall coder
1 files changed, 6 insertions(+), 6 deletions(-)

M lib/dhall/coder.rb
M lib/dhall/coder.rb => lib/dhall/coder.rb +6 -6
@@ 35,8 35,8 @@ module Dhall
			end
		end

		def self.load(source, transform_keys: :to_s)
			new.load(source, transform_keys: transform_keys)
		def self.load(source, transform_keys: :to_s, timeout: 10)
			new.load(source, transform_keys: transform_keys, timeout: timeout)
		end

		def self.dump(obj)


@@ 49,17 49,17 @@ module Dhall
			@verifier.verify(default, "default value")
		end

		def load_async(source, op="load_async", transform_keys: :to_s)
		def load_async(source, op="load_async", transform_keys: :to_s, timeout: 10)
			return Promise.resolve(@default) if source.nil?
			return Promise.resolve(source) unless source.is_a?(String)

			Dhall.load(source).then do |expr|
			Dhall.load(source, timeout: timeout).then do |expr|
				decode(expr, op, transform_keys: transform_keys)
			end
		end

		def load(source, transform_keys: :to_s)
			load_async(source, "load", transform_keys: transform_keys).sync
		def load(source, transform_keys: :to_s, timeout: 10)
			load_async(source, "load", transform_keys: transform_keys, timeout: timeout).sync
		end

		module ToRuby