Sha256: ce1d6c0e613a09f8734d4fa5e89edf6c963ffac619f96131620bd8a9f8203e11

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Burlap
  class Array < ::Array

    def to_burlap
      # <list><type>[string</type><length>1</length><string>Some</string></list>
      list_content = [
        Burlap::Node.new(:name => "type", :value => "").to_burlap,
        Burlap::Node.new(:name => "length", :value => self.length.to_s).to_burlap
      ]
      list_content += self.map do |element|
        element.to_burlap
      end
      list_content = list_content.join("")
      Burlap::Node.new(:name => "list", :value => list_content).to_burlap
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
burlap-1.0.0 lib/burlap/array.rb