CFPropertyList 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
 - data/lib/rbBinaryCFPropertyList.rb +5 -5
 - data/lib/rbCFPropertyList.rb +11 -2
 - metadata +4 -4
 
    
        data/README
    CHANGED
    
    | 
         @@ -27,7 +27,7 @@ for more documentation. 
     | 
|
| 
       27 
27 
     | 
    
         
             
              plist.save("example.plist", CFPropertyList::List::FORMAT_BINARY)
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
              # … later, read it again
         
     | 
| 
       30 
     | 
    
         
            -
              plist = CFPropertyList::List.new("example.plist")
         
     | 
| 
      
 30 
     | 
    
         
            +
              plist = CFPropertyList::List.new(:file => "example.plist")
         
     | 
| 
       31 
31 
     | 
    
         
             
              data = CFPropertyList.native_types(plist.value)
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            Author::    Christian Kruse (mailto:cjk@wwwtech.de)
         
     | 
| 
         @@ -44,7 +44,7 @@ module CFPropertyList 
     | 
|
| 
       44 
44 
     | 
    
         
             
                  formats = ["","C*","n*","(H6)*","N*"]
         
     | 
| 
       45 
45 
     | 
    
         
             
                  @offsets = coded_offset_table.unpack(formats[offset_size])
         
     | 
| 
       46 
46 
     | 
    
         
             
                  if(offset_size == 3) then
         
     | 
| 
       47 
     | 
    
         
            -
                    0.upto(@offsets. 
     | 
| 
      
 47 
     | 
    
         
            +
                    0.upto(@offsets.size-1) { |i| @offsets[i] = @offsets[i].to_i(16) }
         
     | 
| 
       48 
48 
     | 
    
         
             
                  end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
                  @object_ref_size = object_ref_size
         
     | 
| 
         @@ -73,7 +73,7 @@ module CFPropertyList 
     | 
|
| 
       73 
73 
     | 
    
         
             
                  binary_str = "bplist00"
         
     | 
| 
       74 
74 
     | 
    
         
             
                  unique_and_count_values(opts[:root])
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                  @count_objects += @unique_table. 
     | 
| 
      
 76 
     | 
    
         
            +
                  @count_objects += @unique_table.size
         
     | 
| 
       77 
77 
     | 
    
         
             
                  @object_ref_size = Binary.bytes_needed(@count_objects)
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
       79 
79 
     | 
    
         
             
                  file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40
         
     | 
| 
         @@ -89,7 +89,7 @@ module CFPropertyList 
     | 
|
| 
       89 
89 
     | 
    
         
             
                  object_offset = 8
         
     | 
| 
       90 
90 
     | 
    
         
             
                  offsets = []
         
     | 
| 
       91 
91 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
                  0.upto(@object_table. 
     | 
| 
      
 92 
     | 
    
         
            +
                  0.upto(@object_table.size-1) do |i|
         
     | 
| 
       93 
93 
     | 
    
         
             
                    binary_str += @object_table[i]
         
     | 
| 
       94 
94 
     | 
    
         
             
                    offsets[i] = object_offset
         
     | 
| 
       95 
95 
     | 
    
         
             
                    object_offset += @object_table[i].bytesize
         
     | 
| 
         @@ -627,7 +627,7 @@ module CFPropertyList 
     | 
|
| 
       627 
627 
     | 
    
         
             
                  saved_object_count = @written_object_count
         
     | 
| 
       628 
628 
     | 
    
         
             
                  @written_object_count += 1
         
     | 
| 
       629 
629 
     | 
    
         | 
| 
       630 
     | 
    
         
            -
                  bdata = Binary.type_bytes("a", val.value. 
     | 
| 
      
 630 
     | 
    
         
            +
                  bdata = Binary.type_bytes("a", val.value.size) # a is 1010, type indicator for arrays
         
     | 
| 
       631 
631 
     | 
    
         | 
| 
       632 
632 
     | 
    
         
             
                  val.value.each do |v|
         
     | 
| 
       633 
633 
     | 
    
         
             
                    bdata += Binary.pack_it_with_size(@object_ref_size,  v.to_binary(self));
         
     | 
| 
         @@ -642,7 +642,7 @@ module CFPropertyList 
     | 
|
| 
       642 
642 
     | 
    
         
             
                  saved_object_count = @written_object_count
         
     | 
| 
       643 
643 
     | 
    
         
             
                  @written_object_count += 1
         
     | 
| 
       644 
644 
     | 
    
         | 
| 
       645 
     | 
    
         
            -
                  bdata = Binary.type_bytes("d",val.value. 
     | 
| 
      
 645 
     | 
    
         
            +
                  bdata = Binary.type_bytes("d",val.value.size) # d=1101, type indicator for dictionary
         
     | 
| 
       646 
646 
     | 
    
         | 
| 
       647 
647 
     | 
    
         
             
                  val.value.each_key do |k|
         
     | 
| 
       648 
648 
     | 
    
         
             
                    str = CFString.new(k)
         
     | 
    
        data/lib/rbCFPropertyList.rb
    CHANGED
    
    | 
         @@ -36,7 +36,7 @@ require 'date' 
     | 
|
| 
       36 
36 
     | 
    
         
             
            #   plist.save("example.plist", CFPropertyList::List::FORMAT_BINARY)
         
     | 
| 
       37 
37 
     | 
    
         
             
            #
         
     | 
| 
       38 
38 
     | 
    
         
             
            #   # … later, read it again
         
     | 
| 
       39 
     | 
    
         
            -
            #   plist = CFPropertyList::List.new( 
     | 
| 
      
 39 
     | 
    
         
            +
            #   plist = CFPropertyList::List.new(:file => "example.plist")
         
     | 
| 
       40 
40 
     | 
    
         
             
            #   data = CFPropertyList.native_types(plist.value)
         
     | 
| 
       41 
41 
     | 
    
         
             
            #
         
     | 
| 
       42 
42 
     | 
    
         
             
            # Author::    Christian Kruse (mailto:cjk@wwwtech.de)
         
     | 
| 
         @@ -65,6 +65,15 @@ require dirname + '/rbBinaryCFPropertyList.rb' 
     | 
|
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
            require 'iconv' unless "".respond_to?("encode")
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
      
 68 
     | 
    
         
            +
            class String
         
     | 
| 
      
 69 
     | 
    
         
            +
              unless("".respond_to?(:bytesize)) then
         
     | 
| 
      
 70 
     | 
    
         
            +
                def bytesize
         
     | 
| 
      
 71 
     | 
    
         
            +
                  self.length
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
            end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       68 
77 
     | 
    
         
             
            module CFPropertyList
         
     | 
| 
       69 
78 
     | 
    
         
             
              # Create CFType hierarchy by guessing the correct CFType, e.g.
         
     | 
| 
       70 
79 
     | 
    
         
             
              #
         
     | 
| 
         @@ -87,7 +96,7 @@ module CFPropertyList 
     | 
|
| 
       87 
96 
     | 
    
         
             
                  return CFBoolean.new(object)
         
     | 
| 
       88 
97 
     | 
    
         
             
                elsif(object.is_a?(String)) then
         
     | 
| 
       89 
98 
     | 
    
         
             
                  return CFString.new(object)
         
     | 
| 
       90 
     | 
    
         
            -
                elsif(object.is_a?(Time) || object.is_a?(DateTime)) then
         
     | 
| 
      
 99 
     | 
    
         
            +
                elsif(object.is_a?(Time) || object.is_a?(DateTime) || object.is_a?(Date)) then
         
     | 
| 
       91 
100 
     | 
    
         
             
                  return CFDate.new(object)
         
     | 
| 
       92 
101 
     | 
    
         
             
                elsif(object.is_a?(IO)) then
         
     | 
| 
       93 
102 
     | 
    
         
             
                  return CFData.new(object.read, CFData::DATA_RAW)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: CFPropertyList
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 27
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 2
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 10
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 2.0.10
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Christian Kruse
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-07- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-07-14 00:00:00 +02:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |