Class: Rust::Function

Inherits:
Object show all
Defined in:
lib/rust-calls.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Function

Returns a new instance of Function.



9
10
11
12
13
# File 'lib/rust-calls.rb', line 9

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

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



6
7
8
# File 'lib/rust-calls.rb', line 6

def arguments
  @arguments
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/rust-calls.rb', line 5

def name
  @name
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/rust-calls.rb', line 7

def options
  @options
end

Instance Method Details

#callObject



32
33
34
# File 'lib/rust-calls.rb', line 32

def call
    Rust._eval(self.to_R)
end

#to_RObject



27
28
29
30
# File 'lib/rust-calls.rb', line 27

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