rubycf 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/plist.c +7 -1
  2. data/lib/rubycf_extensions.rb +2 -2
  3. metadata +2 -2
data/lib/plist.c CHANGED
@@ -155,7 +155,13 @@ VALUE rbcf_plist_encode(int argc, VALUE *argv, VALUE self) {
155
155
  VALUE structure, encoding;
156
156
  rb_scan_args(argc, argv, "11", &structure, &encoding);
157
157
 
158
- CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; // the format of the plist
158
+ CFPropertyListFormat format; // the output format of the plist
159
+ if(encoding != Qnil && rb_to_id(encoding) == rb_intern("xml")) {
160
+ format = kCFPropertyListXMLFormat_v1_0;
161
+ }
162
+ else {
163
+ format = kCFPropertyListBinaryFormat_v1_0;
164
+ }
159
165
  CFStringRef errorString; // Parsing error string
160
166
 
161
167
  CFPropertyListRef cf_structure = rbcf_plist_convert_to_cf(structure);
@@ -45,10 +45,10 @@ module RubyCF
45
45
  end
46
46
 
47
47
  class Object
48
- def to_plist
48
+ def to_plist(type = :binary)
49
49
  # supported types
50
50
  # [Integer, Float, String, Array, Hash, RubyCF::Data].each do |klass|
51
- return RubyCF::PList.encode(self) #if self.is_a? klass
51
+ return RubyCF::PList.encode(self, type) #if self.is_a? klass
52
52
  # end
53
53
  #
54
54
  # if self.resond_to? :to_hash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Grijalva
@@ -9,7 +9,7 @@ autorequire: rubycf
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-02 00:00:00 -08:00
12
+ date: 2009-11-30 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15