Skip to content
Browse files

Change case statement against 'data' instead of 'a', and added Fixnum…

… as posible case
  • Loading branch information...
1 parent b2cebeb commit de4541dcdc9cea0c58d550f3bb2cdf8ff5d51ba2 @amian84 committed Aug 1, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/ohai/system.rb
View
8 lib/ohai/system.rb
@@ -244,14 +244,14 @@ def attributes_print(a)
data = data[part]
end
raise ArgumentError, "I cannot find an attribute named #{a}!" if data.nil?
- case a
- when Hash,Mash,Array
+ case data
+ when Hash,Mash,Array,Fixnum
json_pretty_print(data)
when String
if data.respond_to?(:lines)
- data.lines.is_a?(Array) ? json_pretty_print(data.lines.to_a) : json_pretty_print([data.lines])
+ json_pretty_print(data.lines.to_a)
else
- data.is_a?(Array) ? json_pretty_print(data.to_a) : json_pretty_print([data])
+ json_pretty_print(data.to_a)
end
else
raise ArgumentError, "I can only generate JSON for Hashes, Mashes, Arrays and Strings. You fed me a #{data.class}!"

0 comments on commit de4541d

Please sign in to comment.
Something went wrong with that request. Please try again.