Class: Rust::Function

Inherits:
Object show all
Defined in:
lib/rust/core/types/language.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Function

Returns a new instance of Function.



98
99
100
101
102
# File 'lib/rust/core/types/language.rb', line 98

def initialize(name)
    @function = name
    @arguments  = Arguments.new
    @options    = Options.new
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



95
96
97
# File 'lib/rust/core/types/language.rb', line 95

def arguments
  @arguments
end

#nameObject (readonly)

Returns the value of attribute name.



94
95
96
# File 'lib/rust/core/types/language.rb', line 94

def name
  @name
end

#optionsObject

Returns the value of attribute options.



96
97
98
# File 'lib/rust/core/types/language.rb', line 96

def options
  @options
end

Instance Method Details

#callObject



121
122
123
# File 'lib/rust/core/types/language.rb', line 121

def call
    Rust._eval(self.to_R)
end

#to_RObject



116
117
118
119
# File 'lib/rust/core/types/language.rb', line 116

def to_R
    params = [@arguments.to_R, @options.to_R].select { |v| v != "" }.join(",")
    return "#@function(#{params})"
end