Module: BOAST::VarFunctors

Included in:
BOAST
Defined in:
lib/BOAST/Language/Functors.rb,
lib/BOAST/Language/Functors.rb,
lib/BOAST/Language/DataTypes.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.var_functorize(klass) ⇒ Object

Creates a functor to create a Variable of type klass

Parameters:

  • klass (DataType)

    DataType to turn into a functor and add it to the VarFunctors module.



53
54
55
56
57
58
59
60
61
# File 'lib/BOAST/Language/Functors.rb', line 53

def var_functorize(klass)
  name = klass.name.split('::').last
  s = "  def \#{name}(*args,&block)\n    Variable::new(args[0],\#{name},*args[1..-1], &block)\n  end\n"
  class_eval s
end

Instance Method Details

#CStruct(name, *args, &block) ⇒ Object

Creates a new Variable of type CStruct.

Parameters:

  • name (#to_s)

    name of the Variable

  • args (Object)

    parameters to use when creating a Variable

  • block (Block)

    block of code will be forwarded



1
# File 'lib/BOAST/Language/DataTypes.rb', line 1

var_functorize CStruct

#CustomType(name, *args, &block) ⇒ Object

Creates a new Variable of type CustomType.

Parameters:

  • name (#to_s)

    name of the Variable

  • args (Object)

    parameters to use when creating a Variable

  • block (Block)

    block of code will be forwarded



1
# File 'lib/BOAST/Language/DataTypes.rb', line 1

var_functorize CustomType

#Int(name, *args, &block) ⇒ Object

Creates a new Variable of type Int.

Parameters:

  • name (#to_s)

    name of the Variable

  • args (Object)

    parameters to use when creating a Variable

  • block (Block)

    block of code will be forwarded



1
# File 'lib/BOAST/Language/DataTypes.rb', line 1

var_functorize Int

#Real(name, *args, &block) ⇒ Object

Creates a new Variable of type Real.

Parameters:

  • name (#to_s)

    name of the Variable

  • args (Object)

    parameters to use when creating a Variable

  • block (Block)

    block of code will be forwarded



1
# File 'lib/BOAST/Language/DataTypes.rb', line 1

var_functorize Real

#Sizet(name, *args, &block) ⇒ Object

Creates a new Variable of type Sizet.

Parameters:

  • name (#to_s)

    name of the Variable

  • args (Object)

    parameters to use when creating a Variable

  • block (Block)

    block of code will be forwarded



1
# File 'lib/BOAST/Language/DataTypes.rb', line 1

var_functorize Sizet