Class: Dhall::FunctionProxyRaw
- Inherits:
-
Function
show all
- Defined in:
- lib/dhall/ast.rb,
lib/dhall/normalize.rb
Instance Method Summary
collapse
Methods inherited from Function
#<<, #>>, #binding, #curry, decode, disable_alpha_normalization!, enable_alpha_normalization!, of_arguments
Methods inherited from Expression
#&, #*, #+, #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.
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/dhall/ast.rb', line 244
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_json ⇒ Object
260
261
262
|
# File 'lib/dhall/ast.rb', line 260
def as_json
raise "Cannot serialize #{self}"
end
|
#call(*args, &block) ⇒ Object
256
257
258
|
# File 'lib/dhall/ast.rb', line 256
def call(*args, &block)
RubyObjectRaw.new(@callable.call(*args.map { |arg| arg&.as_dhall }, &block))
end
|
#normalize ⇒ Object
132
133
134
|
# File 'lib/dhall/normalize.rb', line 132
def normalize
self
end
|
#shift ⇒ Object
124
125
126
|
# File 'lib/dhall/normalize.rb', line 124
def shift(*)
self
end
|
#substitute ⇒ Object
128
129
130
|
# File 'lib/dhall/normalize.rb', line 128
def substitute(*)
raise "Cannot substitute #{self}"
end
|