chruby icon indicating copy to clipboard operation
chruby copied to clipboard

extract "find .ruby-version and return its value" to private method

Open JeanMertz opened this issue 10 years ago • 3 comments

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 public chruby_auto function?

There is only the minor upside to chruby in that it creates a better separation of concern in auto.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 a ruby-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.

JeanMertz avatar May 09 '14 08:05 JeanMertz

I think that would be a good refactor, helping clarity of intent. It might also be helpful to anyone looking to do something similar.

booch avatar May 25 '14 01:05 booch

I finally got around to this in ccae75a26017bfdb2e4ef499c8a6ed5aea00db38.

postmodern avatar Mar 14 '15 03:03 postmodern

@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.

JeanMertz avatar Jan 18 '16 21:01 JeanMertz