Class/Module Index [+]

Quicksearch

Facter::Util::CFPropertyList::CFData

This class contains binary data values

Constants

DATA_BASE64

Base64 encoded data

DATA_RAW

Raw data

Public Class Methods

new(value=nil,format=DATA_BASE64) click to toggle source

set value to defined state, either base64 encoded or raw

# File lib/facter/util/cfpropertylist/lib/rbCFTypes.rb, line 162
def initialize(value=nil,format=DATA_BASE64)
  if(format == DATA_RAW)
    @raw_value = value
    @raw_value.blob = true
  else
    @value = value
  end
end

Public Instance Methods

decoded_value() click to toggle source

get base64 decoded value

# File lib/facter/util/cfpropertylist/lib/rbCFTypes.rb, line 177
def decoded_value
  @raw_value ||= String.new(Base64.decode64(@value))
  @raw_value.blob = true
  @raw_value
end
encoded_value() click to toggle source

get base64 encoded value

# File lib/facter/util/cfpropertylist/lib/rbCFTypes.rb, line 172
def encoded_value
  @value ||= "\n#{Base64.encode64(@raw_value).gsub("\n", '').scan(/.{1,76}/).join("\n")}\n"
end
to_binary(bplist) click to toggle source

convert to binary

# File lib/facter/util/cfpropertylist/lib/rbCFTypes.rb, line 191
def to_binary(bplist)
  bplist.data_to_binary(decoded_value())
end
to_xml(parser) click to toggle source

convert to XML

# File lib/facter/util/cfpropertylist/lib/rbCFTypes.rb, line 184
def to_xml(parser)
  n = parser.new_node('data')
  n = parser.append_node(n, parser.new_text(encoded_value()))
  n
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.