This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/modules/ruby/functions/ruby-info

30 lines
633 B
Plaintext
Raw Normal View History

2012-09-06 23:06:50 -04:00
#
2012-09-06 23:17:38 -04:00
# Exposes information about the Ruby environment via the $ruby_info associative
# array.
2012-09-06 23:06:50 -04:00
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local version
local version_format
local version_formatted
# Clean up previous $ruby_info.
unset ruby_info
typeset -gA ruby_info
if (( $+commands[rvm-prompt] )); then
version="$(rvm-prompt)"
elif (( $+commands[rbenv] )); then
version="$(rbenv version-name)"
fi
# Format version.
if [[ -n "$version" ]]; then
zstyle -s ':prezto:module:ruby' version 'version_format'
zformat -f version_formatted "$version_format" "v:$version"
ruby_info[version]="$version_formatted"
fi