Class: Rri::RConverters::IntegerConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/rri/r_converters/integer_converter.rb

Overview

Converter for ruby Integers

Convert ruby Integer to integer in R

Instance Method Summary collapse

Instance Method Details

#convert(obj) ⇒ Array

Convert ruby object to R format

If the ruby object is an Integer, converts it into an R integer

Parameters:

  • obj

    object to convert

Returns:

  • (Array)

    an array of size 2 where first element is a boolean indicating succes, and the second element is the converted object if conversion successful



18
19
20
21
22
23
24
# File 'lib/rri/r_converters/integer_converter.rb', line 18

def convert(obj)
  if obj.kind_of? Integer
    [true, REXPInteger.new(obj)]
  else
    [false, nil]
  end
end