From: Dreamcat Four on
Hmm,
This seems to be invalid:

p << do
args << "evaluated"
end


But this is okay

p.<< do
args << "evaluated"
end


Well, for REE 1.8.7 interpreter at least.
--
Posted via http://www.ruby-forum.com/.

From: Dreamcat Four on
Hi,
For any of you who were interested, here is the interface which was
finally settled upon.


# Example 1
Plist4r::Config.default_dir "/Library/LaunchDaemons"
filename = "com.github.myservice"
p = Plist4r.new(filename)

p.<< do
ProgramArguments ["/usr/local/bin/myservice"]
end

p.edit do
WatchPaths ["/var/db/myservice"]
end

p.save



# Example 2
class MyXmlReader < ::Plist4r::ReaderBase
end
Plist4r::Config.readers << MyXmlReader

class MyBinaryWriter < ::Plist4r::WriterBase
end
Plist4r::Config.writers << MyBinaryWriter


Plist4r::Config.default_dir "/Library/LaunchDaemons"

car = Plist4r.new("car.plist")

car.load # autodetects plist file_format and plist_type

car.file_format :binary
car.plist_type :car

car.save

car.<< do
road_legal true
brake_light_color "red"
end

car.save_as("car2.plist", :binary => true)

car.<< do
eyes "blue"
end
# => Exception, invalid plist key name "Eyes"

car.<< do
tyres "Pirelli"
end

--
Posted via http://www.ruby-forum.com/.