Class: Dhallish::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/types.rb

Overview

To be used as Dhallish::Value.val for dhall-defined functions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argname, ast, ctx) ⇒ Function

Returns a new instance of Function.



325
326
327
328
329
# File 'lib/types.rb', line 325

def initialize(argname, ast, ctx)
	@argname = argname
	@ast = ast
	@ctx = ctx
end

Instance Attribute Details

#argnameObject

Returns the value of attribute argname.



322
323
324
# File 'lib/types.rb', line 322

def argname
  @argname
end

#astObject

Returns the value of attribute ast.



323
324
325
# File 'lib/types.rb', line 323

def ast
  @ast
end

#ctxObject

Returns the value of attribute ctx.



324
325
326
# File 'lib/types.rb', line 324

def ctx
  @ctx
end

Instance Method Details

#call(arg) ⇒ Object



331
332
333
334
335
# File 'lib/types.rb', line 331

def call(arg)
	newctx = Context.new ctx
	newctx[@argname] = arg
	@ast.evaluate newctx
end