class Rserve::REXP::String

Constants

NA

Attributes

payload[R]

Public Class Methods

new(data, attrs=nil) click to toggle source
Calls superclass method Rserve::REXP::new
# File lib/rserve/rexp/string.rb, line 6
def initialize(data, attrs=nil)
  @payload=case data
  when Array
    data.map {|v| v.to_s}
  else
    [data.to_s]
  end
  super(attrs)
end

Public Instance Methods

as_strings() click to toggle source
# File lib/rserve/rexp/string.rb, line 21
def as_strings
  @payload
end
length() click to toggle source
# File lib/rserve/rexp/string.rb, line 15
def length
  payload.length
end
na?(value=:nil) click to toggle source
# File lib/rserve/rexp/string.rb, line 25
def na?(value=:nil)

  if value==:nil
    @payload.map {|v|
      v.unpack("C")==[255] or v=="NA" # Ugly hack
    }
  else
    value.unpack("C")==[255] or value=="NA"
  end
end
string?() click to toggle source
# File lib/rserve/rexp/string.rb, line 18
def string?
  true
end
to_debug_string() click to toggle source
Calls superclass method Rserve::REXP#to_debug_string
# File lib/rserve/rexp/string.rb, line 35
def to_debug_string
  t=super
  t << "{"  << @payload.map(&:to_s).join(",") << "}"
end