ActiveSupport::Cache::Strategy::LocalCache::Middleware shown in hash presentation #1911

Closed
joneslee85 opened this Issue Jun 30, 2011 · 7 comments

Projects

None yet

3 participants

@joneslee85
Contributor
  1. Generate new app with rails3.1.0.rc4
  2. View 0.0.0.0:3000
  3. Expand About your app's env
  4. In Middleware section, found this hash presentation #ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000101ec1c90

Double check under console

ree-1.8.7-2011.03 :001 > Rails.configuration.middleware
 => #, Rack::Runtime, Rack::MethodOverride, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::RemoteIp, Rack::Sendfile, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport]> 
@dmathieu
Contributor
dmathieu commented Jul 1, 2011

That seems normal. The added middleware is an instance of the class, not the object itself.
It's not a bug and I believe this to be the expected behavior.

@joneslee85
Contributor

Isn't it? It looks a bit ugly, unless there is way to beautify it.

@dmathieu
Contributor
dmathieu commented Jul 2, 2011

There would be a way, which would be to overwrite the #inspect method of the object. But that would make it unclear with possible side effects.

@dmitriy-kiriyenko
Contributor

To fix this, someone should not overwrite the #inspect method, but call other method on Middleware, perhaps, to_s, which should be defined to display the Middleware in a more beautiful way.

@dmathieu
Contributor
dmathieu commented Jul 2, 2011

I don't think this should be changed.
This representation has a meaning which is understood by developers because it's defined like that by the ruby language.
Changing it will make the representation of this instance harder to understand.

Moreover, to be implemented properly, it'd require to define it for all classes, not only this one.
Any new middleware can be added to the stack and it won't be displayed the same way as this one.

@dmitriy-kiriyenko
Contributor

Sure. I totally agree with you and believe it's not an issue. My sentence if conditional =)

@joneslee85
Contributor

If so, i close it.

@joneslee85 joneslee85 closed this Jul 3, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment