Class: Rserve::REXP::GenericVector

Inherits:
Vector show all
Defined in:
lib/rserve/rexp/genericvector.rb

Direct Known Subclasses

ExpressionVector

Constant Summary

Constants inherited from Rserve::REXP

MaxDebugItems, MismatchError

Instance Attribute Summary collapse

Attributes inherited from Rserve::REXP

#attr

Instance Method Summary collapse

Methods inherited from Vector

#==, #na?, #to_a, #vector?

Methods inherited from Rserve::REXP

#as_bytes, #as_double, #as_double_matrix, #as_doubles, #as_factor, #as_float, #as_floats, #as_integer, #as_integers, #as_matrix, #as_nested_array, #as_string, #as_strings, #complex?, create_data_frame, #dim, #environment?, #expression?, #factor?, #get_attribute, #has_attribute?, #inherits?, #integer?, #language?, #logical?, #na?, #null?, #numeric?, #pair_list?, #raw?, #reference?, #split_array, #string?, #symbol?, #to_debug_string, #to_f, #to_i, #to_ruby, #vector?

Constructor Details

#initialize(list, attr = nil) ⇒ GenericVector

Returns a new instance of GenericVector.



5
6
7
8
9
10
11
12
13
# File 'lib/rserve/rexp/genericvector.rb', line 5

def initialize(list, attr=nil)
  super(attr)
  @payload=list.nil? ? Rlist.new() : list
  if (attr.nil? and payload.named? )
    @attr = REXP::List.new(
    Rlist.new([REXP::String.new(payload.keys())],
    ["names"]));
  end
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



4
5
6
# File 'lib/rserve/rexp/genericvector.rb', line 4

def payload
  @payload
end

Instance Method Details

#as_listObject



23
24
25
# File 'lib/rserve/rexp/genericvector.rb', line 23

def as_list
  @payload
end

#lengthObject



14
15
16
# File 'lib/rserve/rexp/genericvector.rb', line 14

def length
  @payload.size
end

#list?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rserve/rexp/genericvector.rb', line 17

def list?
  true
end

#recursive?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/rserve/rexp/genericvector.rb', line 20

def recursive?
  true
end

#to_ruby_internalObject



26
27
28
# File 'lib/rserve/rexp/genericvector.rb', line 26

def to_ruby_internal
  @payload.to_ruby
end