12 messages in com.perforce.p4ruby[p4ruby] Canvassing opinions...| From | Sent On | Attachments |
|---|---|---|
| Tony Smith | 07 Dec 2004 09:12 | |
| Bennett, Patrick | 07 Dec 2004 09:42 | |
| Tony Smith | 07 Dec 2004 10:08 | |
| Bennett, Patrick | 07 Dec 2004 10:24 | |
| Shackelford, John-Mason | 07 Dec 2004 11:08 | |
| Johan Nilsson | 08 Dec 2004 00:11 | |
| Tony Smith | 08 Dec 2004 06:25 | |
| Bennett, Patrick | 08 Dec 2004 06:42 | |
| Shackelford, John-Mason | 08 Dec 2004 08:18 | |
| Tony Smith | 08 Dec 2004 08:20 | |
| Tony Smith | 08 Dec 2004 08:24 | |
| Tony Smith | 09 Dec 2004 05:47 |
| Subject: | [p4ruby] Canvassing opinions...![]() |
|---|---|
| From: | Tony Smith (to...@smee.org) |
| Date: | 12/07/2004 09:12:43 AM |
| List: | com.perforce.p4ruby |
I've got a change to P4Ruby that I'm considering to run by you. I'd like to know if this is something that people want/need or whether I should leave well alone.
The idea is that all the form parsing methods would return a P4::Spec object instead of a Hash - though you'll notice little difference since a P4::Spec object is a subclass of Hash. The advantage of a P4::Spec object is that it:
(a) ensures that you only set valid fields (b) provides you with accessor methods for all valid fields (c) the accessor methods are all prefixed with an '_' to avoid colliding with methods from Hash itself (Hash#update was the one that bit me). The underscores are a bit Pythonesque, but seemed like a reasonable choice. I'm open to suggestions though. (d) the accessor methods are all lowercase for consistency - regardless of the case of the field in the form.
Usage is something like this:
p4 = P4.new p4.parse_forms p4.connect
client = p4.fetch_client client._description = "My new client description" client._root = "/tmp"
client._view.each do |mapping| puts( mapping ) end
Since these are still hashes, they can also be supplied as input to update Perforce:
p4.save_client( client )
Feedback appreciated.
Tony




