Class: Rserve::REXP::List
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?
#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?, #raw?, #reference?, #split_array, #string?, #symbol?, #to_f, #to_i, #to_ruby, #vector?
Constructor Details
#initialize(list, attrs = nil) ⇒ List
Returns a new instance of List.
5
6
7
8
|
# File 'lib/rserve/rexp/list.rb', line 5
def initialize(list, attrs=nil)
@payload=list.nil? ? RList.new : list
super(attrs)
end
|
Instance Attribute Details
#payload ⇒ Object
Returns the value of attribute payload.
4
5
6
|
# File 'lib/rserve/rexp/list.rb', line 4
def payload
@payload
end
|
Instance Method Details
#as_list ⇒ Object
21
22
23
|
# File 'lib/rserve/rexp/list.rb', line 21
def as_list
@payload
end
|
#length ⇒ Object
9
10
11
|
# File 'lib/rserve/rexp/list.rb', line 9
def length
payload.size
end
|
#list? ⇒ Boolean
12
13
14
|
# File 'lib/rserve/rexp/list.rb', line 12
def list?
true
end
|
#pair_list? ⇒ Boolean
15
16
17
|
# File 'lib/rserve/rexp/list.rb', line 15
def pair_list?
true
end
|
#recursive? ⇒ Boolean
18
19
20
|
# File 'lib/rserve/rexp/list.rb', line 18
def recursive?
true
end
|
#to_debug_string ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/rserve/rexp/list.rb', line 27
def to_debug_string
t=super+(as_list.named? ? "named":"")
if @payload.named?
inner="{"+@payload.size.times.map {|i| "#{@payload.names[i]}=#{@payload.data[i].to_debug_string}"}.join(",")+"}"
else
inner="{"+@payload.size.times.map {|i| "#{@payload.data[i].to_debug_string}"}.join(",")+"}"
end
t+inner
end
|
#to_ruby_internal ⇒ Object
36
37
38
|
# File 'lib/rserve/rexp/list.rb', line 36
def to_ruby_internal
as_list.to_ruby
end
|
#to_s ⇒ Object
24
25
26
|
# File 'lib/rserve/rexp/list.rb', line 24
def to_s
super+(as_list.named? ? "named":"")
end
|