Class: LaunchdTools::PathContent
- Inherits:
-
Object
- Object
- LaunchdTools::PathContent
- Defined in:
- lib/launchd_tools/path_content.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #binary? ⇒ Boolean
-
#initialize(path) ⇒ PathContent
constructor
A new instance of PathContent.
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ PathContent
Returns a new instance of PathContent.
4 5 6 |
# File 'lib/launchd_tools/path_content.rb', line 4 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/launchd_tools/path_content.rb', line 3 def path @path end |
Instance Method Details
#binary? ⇒ Boolean
16 17 18 19 20 21 |
# File 'lib/launchd_tools/path_content.rb', line 16 def binary? f = File.open(path, "r") f.read(6) == "bplist" ensure f.close if f end |
#to_s ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/launchd_tools/path_content.rb', line 8 def to_s if binary? `plutil -convert xml1 -o /dev/stdout '#{path}'` else File.read(path) end end |