Open JeanMertz opened 10 years ago
I think that would be a good refactor, helping clarity of intent. It might also be helpful to anyone looking to do something similar.
I finally got around to this in ccae75a26017bfdb2e4ef499c8a6ed5aea00db38.
@postmodern any reason that specific commit was never merged? I wanted to make use of it right now, but turns out it never made it into master, which is a pity.
Do you feel something for extracting "finding
.ruby-version
and reading its content" into a separate function like__ruby_version_content
, and using that in the publicchruby_auto
function?There is only the minor upside to
chruby
in that it creates a better separation of concern inauto.sh
(which currently is basically one big public function), but it does create a more friendly "api" where other implementations can use this function to get the content of aruby-version
file without reimplementing the functionality.This request stems from the remark: https://github.com/JeanMertz/chruby-fish/issues/9#issuecomment-42643013, and my conclusion: https://github.com/JeanMertz/chruby-fish/issues/9#issuecomment-42644497.
Of course, it's not a very useful change for
chruby
, and I doubt many others will use it, but it never hurts to ask, and I feel like it could increase the readability of the source code for chruby as well.