plist 3.6.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a76784a6b7e953d1cd9b6deaf390eb7556fd0df83e8970db7ac4640c71493b4
4
- data.tar.gz: 8324c2b332839aa772eb77a4a760b24e43e24c363c99d01c2b2b4b11e311938a
3
+ metadata.gz: 34fa4fc386b9fb97f4e27a345e5a15fcae275edba2e2c92285ef04ffb25ee2b8
4
+ data.tar.gz: a0a416e828b8232c07fe1b817929b55697c2234856d2a2801123e3df9cc6bb17
5
5
  SHA512:
6
- metadata.gz: c33686b606d723821333314b4a18fe6ac39d65a3712aa1cd43896dbbd4bfb95130aa0a1f62b4a3b260c2a633d44681eec0766fef5651ae70580340a905e4f6e4
7
- data.tar.gz: 5b63b55469235ec79f14af6f25c05cbc8e6088ce9532e9dfc5aa0887e533a7ee67424953d62e0b3dfe046c7745d9a2add1e0b8ddf07c34f46c5a551c92a9a158
6
+ metadata.gz: e0742f71c11f859b4b104b0e3f2bf8896b736397fbfe54eef20b72439a582448af160649c205507b66aa87c506d216745f794b73fe8aa77c3e7f576289b68c88
7
+ data.tar.gz: c413bc34bdfb8edd54377bb7fb9210ccfa81992b98acb131499582785aec7b7764c1463eacfdb6768bfe3d70d1bde213045b08182a6ed60b8f44b2ee18ef9974
data/lib/plist/parser.rb CHANGED
@@ -26,8 +26,13 @@ module Plist
26
26
  # can't be parsed into a Time object, please create an issue
27
27
  # attaching your plist file at https://github.com/patsplat/plist/issues
28
28
  # so folks can implement the proper support.
29
- def self.parse_xml(filename_or_xml)
30
- listener = Listener.new
29
+ #
30
+ # By default, <data> will be assumed to be a marshaled Ruby object and
31
+ # interpreted with <tt>Marshal.load</tt>. Pass <tt>marshal: false</tt>
32
+ # to disable this behavior and return the raw binary data as an IO
33
+ # object instead.
34
+ def self.parse_xml(filename_or_xml, options={})
35
+ listener = Listener.new(options)
31
36
  # parser = REXML::Parsers::StreamParser.new(File.new(filename), listener)
32
37
  parser = StreamParser.new(filename_or_xml, listener)
33
38
  parser.parse
@@ -39,13 +44,14 @@ module Plist
39
44
 
40
45
  attr_accessor :result, :open
41
46
 
42
- def initialize
47
+ def initialize(options={})
43
48
  @result = nil
44
49
  @open = []
50
+ @options = { :marshal => true }.merge(options).freeze
45
51
  end
46
52
 
47
53
  def tag_start(name, attributes)
48
- @open.push PTag.mappings[name].new
54
+ @open.push PTag.mappings[name].new(@options)
49
55
  end
50
56
 
51
57
  def text(contents)
@@ -154,9 +160,10 @@ module Plist
154
160
  mappings[key] = sub_class
155
161
  end
156
162
 
157
- attr_accessor :text, :children
158
- def initialize
163
+ attr_accessor :text, :children, :options
164
+ def initialize(options)
159
165
  @children = []
166
+ @options = options
160
167
  end
161
168
 
162
169
  def to_ruby
@@ -244,13 +251,13 @@ module Plist
244
251
  def to_ruby
245
252
  data = Base64.decode64(text.gsub(/\s+/, '')) unless text.nil?
246
253
  begin
247
- return Marshal.load(data)
254
+ return Marshal.load(data) if options[:marshal]
248
255
  rescue Exception
249
- io = StringIO.new
250
- io.write data
251
- io.rewind
252
- return io
253
256
  end
257
+ io = StringIO.new
258
+ io.write data
259
+ io.rewind
260
+ io
254
261
  end
255
262
  end
256
263
  end
data/lib/plist/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Plist
4
- VERSION = '3.6.0'.freeze
4
+ VERSION = '3.7.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Bleything
@@ -9,50 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-30 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '1.14'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '1.14'
28
- - !ruby/object:Gem::Dependency
29
- name: rake
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '10.5'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '10.5'
42
- - !ruby/object:Gem::Dependency
43
- name: test-unit
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '1.2'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '1.2'
12
+ date: 2023-02-21 00:00:00.000000000 Z
13
+ dependencies: []
56
14
  description: Plist is a library to manipulate Property List files, also known as plists.
57
15
  It can parse plist files into native Ruby data structures as well as generating
58
16
  new plist files from your Ruby objects.
@@ -85,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
43
  - !ruby/object:Gem::Version
86
44
  version: '0'
87
45
  requirements: []
88
- rubygems_version: 3.2.3
46
+ rubygems_version: 3.4.7
89
47
  signing_key:
90
48
  specification_version: 4
91
49
  summary: All-purpose Property List manipulation library