Class: Dhall::FunctionProxyRaw

Inherits:
Function show all
Defined in:
lib/dhall/ast.rb,
lib/dhall/normalize.rb

Direct Known Subclasses

FunctionProxy

Instance Method Summary collapse

Methods inherited from Function

#<<, #>>, #binding, #curry, decode, disable_alpha_normalization!, enable_alpha_normalization!, of_arguments

Methods inherited from Expression

#&, #*, #+, #annotate, #as_dhall, #cache_key, #concat, decode, #deep_merge, #deep_merge_type, #dhall_eq, #digest, #fetch, #fusion, #merge, #resolve, #slice, #to_binary, #to_cbor, #to_proc, #to_s, #|

Constructor Details

#initialize(callable, curry: true) ⇒ FunctionProxyRaw

Returns a new instance of FunctionProxyRaw.



248
249
250
251
252
253
254
255
256
257
258
# File 'lib/dhall/ast.rb', line 248

def initialize(callable, curry: true)
	@callable = if !curry
		callable
	elsif callable.respond_to?(:curry)
		callable.curry
	elsif callable.respond_to?(:to_proc)
		callable.to_proc.curry
	else
		callable.method(:call).to_proc.curry
	end
end

Instance Method Details

#as_jsonObject



264
265
266
# File 'lib/dhall/ast.rb', line 264

def as_json
	raise "Cannot serialize #{self}"
end

#call(*args, &block) ⇒ Object



260
261
262
# File 'lib/dhall/ast.rb', line 260

def call(*args, &block)
	RubyObjectRaw.new(@callable.call(*args.map { |arg| arg&.as_dhall }, &block))
end

#normalizeObject



143
144
145
# File 'lib/dhall/normalize.rb', line 143

def normalize
	self
end

#shiftObject



135
136
137
# File 'lib/dhall/normalize.rb', line 135

def shift(*)
	self
end

#substituteObject



139
140
141
# File 'lib/dhall/normalize.rb', line 139

def substitute(*)
	raise "Cannot substitute #{self}"
end