Module: Plist4r
- Defined in:
-
lib/plist4r.rb,
lib/plist4r/cli.rb,
lib/plist4r/plist.rb,
lib/plist4r/config.rb,
lib/plist4r/backend.rb,
lib/plist4r/commands.rb,
lib/plist4r/plist_type.rb,
lib/plist4r/plist_cache.rb,
lib/plist4r/application.rb,
lib/plist4r/mixin/table.rb,
lib/plist4r/backend_base.rb,
lib/plist4r/mixin/popen4.rb,
lib/plist4r/mixin/script.rb,
lib/plist4r/plist_type/info.rb,
lib/plist4r/plist_type/plist.rb,
lib/plist4r/mixin/mixlib_cli.rb,
lib/plist4r/mixin/array_dict.rb,
lib/plist4r/backend/ruby_cocoa.rb,
lib/plist4r/mixin/ordered_hash.rb,
lib/plist4r/mixin/ordered_hash.rb,
lib/plist4r/plist_type/launchd.rb,
lib/plist4r/mixin/data_methods.rb,
lib/plist4r/mixin/mixlib_config.rb,
lib/plist4r/backend/test/output.rb,
lib/plist4r/backend/test/harness.rb,
lib/plist4r/backend/test/data_types.rb
Modules
Classes
- Application
- ArrayDict
- Backend
- CLI
- Commands
- Config
- OrderedHash
- Plist
- PlistCache
- PlistType
- Script
- Table
Class Methods
Overview
require ‘plist4r/backend’
Class Method Details
+ (Symbol) file_detect_format(filename)
Given a Plist filename, peek the first few bytes and detect the file format
77 78 79 |
# File 'lib/plist4r.rb', line 77 def file_detect_format filename string_detect_format File.read(filename) end |
+ (Plist4r::Plist) new(*args, &blk)
Calls Plist4r::Plist.new with the supplied arguments and block
19 20 21 |
# File 'lib/plist4r.rb', line 19 def new *args, &blk return Plist.new *args, &blk end |
+ (Plist4r::Plist) open(filename, *args, &blk)
Opens a plist file
32 33 34 35 |
# File 'lib/plist4r.rb', line 32 def open filename, *args, &blk p = Plist.new filename, *args, &blk p.open end |
+ (Symbol) string_detect_format(string)
Given an string of Plist data, peek the first few bytes and detect the file format
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/plist4r.rb', line 44 def string_detect_format string if RUBY_VERSION >= '1.9' string = string.force_encoding(Encoding::ASCII_8BIT) end string.strip! if string[0,1] =~ /\s/ case string[0,1] when "{","(" :gnustep when "b" if string =~ /^bplist/ :binary else nil end when "<" if string =~ /^\<\?xml/ && string =~ /\<\!DOCTYPE plist/ :xml else nil end else nil end end |