Class: CFPropertyList::CFArray

Inherits:
CFType
  • Object
show all
Defined in:
lib/cfpropertylist/rbCFTypes.rb

Overview

This class contains an array of values

Instance Attribute Summary

Attributes inherited from CFType

#value

Instance Method Summary collapse

Constructor Details

#initialize(val = []) ⇒ CFArray

create a new array CFType



273
274
275
# File 'lib/cfpropertylist/rbCFTypes.rb', line 273

def initialize(val=[])
  @value = val
end

Instance Method Details

#to_binary(bplist) ⇒ Object

convert to binary



287
288
289
# File 'lib/cfpropertylist/rbCFTypes.rb', line 287

def to_binary(bplist)
  bplist.array_to_binary(self)
end

#to_plain(plist) ⇒ Object



291
292
293
294
# File 'lib/cfpropertylist/rbCFTypes.rb', line 291

def to_plain(plist)
  ary = @value.map { |v| v.to_plain(plist) }
  "( " + ary.join(", ") + " )"
end

#to_xml(parser) ⇒ Object

convert to XML



278
279
280
281
282
283
284
# File 'lib/cfpropertylist/rbCFTypes.rb', line 278

def to_xml(parser)
  n = parser.new_node('array')
  @value.each do |v|
    n = parser.append_node(n, v.to_xml(parser))
  end
  n
end