Class: Jade::Type::Function

Inherits:
Data
  • Object
show all
Includes:
Base
Defined in:
lib/jade/type/function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



3
4
5
# File 'lib/jade/type/function.rb', line 3

def args
  @args
end

#return_typeObject (readonly)

Returns the value of attribute return_type

Returns:

  • (Object)

    the current value of return_type



3
4
5
# File 'lib/jade/type/function.rb', line 3

def return_type
  @return_type
end

Instance Method Details

#to_sObject



6
7
8
9
10
# File 'lib/jade/type/function.rb', line 6

def to_s
  args
    .map(&:to_s).join(', ')
    .then { "(#{it})"} + " -> " + return_type.to_s
end

#unbound_varsObject



12
13
14
15
# File 'lib/jade/type/function.rb', line 12

def unbound_vars
  (args.flat_map(&:unbound_vars) + return_type.unbound_vars)
    .to_set.to_a
end