Sha256: 17048fc78813aaa53f9864353b2064f847dd92c27fc8283702b26b84b6b1e39a

Contents?: true

Size: 933 Bytes

Versions: 3

Compression:

Stored size: 933 Bytes

Contents

module Rserve
  class REXP
    class List < REXP::Vector
      attr_reader :payload
      def initialize(list, attrs=nil)
        @payload=list.nil? ? RList.new : list
        super(attrs)
      end
      def length
        payload.size
      end
      def list?
        true
      end
      def pair_list?
        true
      end
      def recursive?
        true
      end
      def as_list
        @payload
      end
      def to_s
        super+(as_list.named? ? "named":"")
      end
      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
      def to_ruby
        as_list.to_ruby
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rserve-client-0.1.8 lib/rserve/rexp/list.rb
rserve-client-0.1.7 lib/rserve/rexp/list.rb
rserve-client-0.1.6 lib/rserve/rexp/list.rb