Method: Vpim::DirectoryInfo::Field.value_str

Defined in:
lib/vpim/field.rb

.value_str(value) ⇒ Object

:nodoc:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/vpim/field.rb', line 85

def Field.value_str(value) # :nodoc:
  line = ''
  case value
    when Date
      line << Vpim.encode_date(value)

    when Time #, DateTime
      line << Vpim.encode_date_time(value)

    when Array
      line << value.map { |v| Field.value_str(v) }.join(';')

    when Symbol
      line << value

    else
      # FIXME - somewhere along here, values with special chars need escaping...
      line << value.to_str
  end
  line
end