class Rust::Sequence

Attributes

max[R]
min[R]

Public Class Methods

new(min, max, step=1) click to toggle source
# File lib/rust-core.rb, line 632
def initialize(min, max, step=1)
    @min = min
    @max = max
    @step = step
end

Public Instance Methods

each() { |v| ... } click to toggle source
# File lib/rust-core.rb, line 642
def each
    (@min..@max).step(@step) do |v|
        yield v
    end
end
load_in_r_as(variable_name) click to toggle source
# File lib/rust-core.rb, line 660
def load_in_r_as(variable_name)
    Rust._eval("#{variable_name} <- #{self.to_R}")
end
step(step) click to toggle source
# File lib/rust-core.rb, line 638
def step(step)
    @step = step
end
to_R() click to toggle source
# File lib/rust-core.rb, line 656
def to_R
    "seq(from=#@min, to=#@max, by=#@step)"
end
to_a() click to toggle source
# File lib/rust-core.rb, line 648
def to_a
    result = []
    self.each do |v|
        result << v
    end
    return result
end