Permalink
Browse files

Prettier inspect.

  • Loading branch information...
1 parent 343f524 commit 06ae432194f8096d7d905fda910c48e5561b099f @jnunemaker committed Jun 22, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/user_agent.rb
View
@@ -173,7 +173,11 @@ def to_s
end
def inspect
- "#<UserAgent:#{name} version:#{version.inspect} engine:\"#{engine.to_s}:#{engine_version}\" os:#{os.to_s.inspect}>"
+ attributes_as_nice_string = AttributesForInspect.map do |name|
+ "#{name}: #{send(name).inspect}"
+ end.join(', ')
+
+ "#<#{self.class}: #{attributes_as_nice_string}>"
end
def eql?(other)

0 comments on commit 06ae432

Please sign in to comment.