class NokogiriPList::Generator

def self.to_s(value, current_indent = 0)

def self.to_s(value, current_indent = 0)
  # Todo: make these procs and allow custom procs (for data for example)
  case value
  when Array
      tag("array", nil, current_indent) do
        value.inject("") do |result, item|
          result + item.to_plist_xml_unchomped(current_indent + 1)
        end
      end
    when Hash
      tag("dict", nil, current_indent) do
        value.inject("") do |result, (dict_key, dict_value)|
          result + tag("key", dict_key, current_indent + 1).chomp +
          dict_value.to_plist_xml_unchomped
        end
      end
    when TrueClass
      tag("true", nil, current_indent)
    when FalseClass
      tag("false", nil, current_indent)
    when Time
      tag("date", value.utc.strftime('%Y-%m-%dT%H:%M:%SZ'), current_indent)
    when Date # also catches DateTime
      tag("date", value.strftime('%Y-%m-%dT%H:%M:%SZ'), current_indent)
    when String, Symbol
      tag("string", value, current_indent)
    when Fixnum, Bignum, Integer
      tag("integer", value, current_indent)
    when Float
      tag("real", value, current_indent)
    when BigDecimal
      tag("real", value.to_s('F'), current_indent)
    end
  end