[Win32utils-devel] Win32 namespace

Berger, Daniel Daniel.Berger at qwest.com
Mon Jul 30 18:02:22 EDT 2007

> -----Original Message-----
> From: win32utils-devel-bounces at rubyforge.org 
> [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of 
> Gordon Thiesfeld
> Sent: Monday, July 30, 2007 3:33 PM
> To: win32utils-devel at rubyforge.org
> Subject: [Win32utils-devel] Win32 namespace
> I've been working on a library called ruby-wmi, that is 
> basically just an abstraction layer around wmi.  I'm a 
> windows sys admin, and I use wmi scripts a lot at work.
> My code looks like this:
> disks = WMI::Win32_LogicalDisk.find(:all, :conditions => 
> {:drivetype => 5})
> It's supposed to mimic the active_record interface, and it 
> works pretty well.

Hey, I like that.

> My next thought was to do something like this:
> disks = Win32::LogicalDisk.find(:all, :conditions => 
> {:drivetype => 5})
> Which I liked a lot, but then I realized that I might be stepping on a
> namespace that was already in use.   That's why I'm posting here.
> Should I not do this?  Is it a bad idea?

How about this:

Win32::WMI::LogicalDisk.find(:all, :conditions => {:drivetype => 5})

And, if you 'include Win32', it boils down to:

WMI::LogicalDisk.find(:all, :conditions => {:drivetype => 5})

I think this approach makes sense, i.e. WMI is part of Win32, and
LogicalDisk is part of WMI.

Mind you, I certainly don't own the Win32 namespace so you can do as you
wish, but I think this is the best approach, as it puts your code
effectively under the "Win32::WMI" namespace, which should eliminate any
potential namespace conflicts.

What do you think?



This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

More information about the win32utils-devel mailing list