summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Gartrell <jgartrel@stevenbeulow2.servepath.com>2009-03-04 13:52:21 -0800
committerjtimberman <joshua@opscode.com>2009-06-18 18:45:48 -0600
commit858c0117851de801222a3c80538e9edc5a766f28 (patch)
tree28c918c3762026791487790be800f37e2f70b74b /lib
parent13fb9d0a01dc84bc3ed84c713d546675ce476a17 (diff)
downloadohai-858c0117851de801222a3c80538e9edc5a766f28.tar.gz
Added comments to wmi_underscore method
Diffstat (limited to 'lib')
-rw-r--r--lib/ohai/mixin/string.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ohai/mixin/string.rb b/lib/ohai/mixin/string.rb
index dd3a35ff..169711a2 100644
--- a/lib/ohai/mixin/string.rb
+++ b/lib/ohai/mixin/string.rb
@@ -17,6 +17,11 @@
#
class String
+ # Add string function to handle WMI property conversion to json hash keys
+ # Makes an underscored, lowercase form from the expression in the string.
+ # underscore will also change ’::’ to ’/’ to convert namespaces to paths.
+ # This should implement the same functionality as underscore method in
+ # ActiveSupport::CoreExtensions::String::Inflections
def wmi_underscore
self.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase