Class: Rust::Function
Overview
Represents a function call in R. After having set up its name (constructor) and, optionally, its arguments and options, it can be used the call method to execute it in the R environment.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#call ⇒ Object
Calls the function in the R environment.
-
#initialize(name) ⇒ Function
constructor
Creates a new function with a given
name
. - #to_R ⇒ Object
Constructor Details
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
115 116 117 |
# File 'lib/rust/core/types/language.rb', line 115 def arguments @arguments end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
114 115 116 |
# File 'lib/rust/core/types/language.rb', line 114 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
116 117 118 |
# File 'lib/rust/core/types/language.rb', line 116 def @options end |
Instance Method Details
#call ⇒ Object
Calls the function in the R environment.
153 154 155 |
# File 'lib/rust/core/types/language.rb', line 153 def call Rust._eval(self.to_R) end |
#to_R ⇒ Object
145 146 147 148 |
# File 'lib/rust/core/types/language.rb', line 145 def to_R params = [@arguments.to_R, @options.to_R].select { |v| v != "" }.join(",") return "#@function(#{params})" end |