junegunn / redis-stat

(UNMAINTAINED) A real-time Redis monitoring tool
MIT License
2.02k stars 339 forks source link

Some refactoring #35

Closed matugm closed 9 years ago

matugm commented 9 years ago

inject -> each_with_object Hash[] is not nedeed here since we already have a hash. The select seems to be there to remove empty values, in my opinion this is best handled by setting defaults. It seems like this is already being handled somewhere else or it's not being covered by test.

junegunn commented 9 years ago

Hi, thanks for the suggestion. However, redis-stat has been maintained to support Ruby 1.8.7 (See git log -i --grep 'ruby 1.8'), but each_with_object is not available on that version, so I can't merge.

The select seems to be there to remove empty values

Because the line above extracts hostname and port by splitting the user-given string, port can be missing. I'm not sure if the constructor of Redis class allows nil port values, but better safe than sorry.

it's not being covered by test

Honestly, the test suite of redis-stat is far from complete :smirk: There are a lot of work to be done to properly test multiple redis instances of different versions and elasticsearch, etc, but I haven't really had time for all that work.