![]() ![]() (There are others as well, like chruby, but their use is much less widespread.) They take different approaches to the problem of using multiple versions of Ruby, but the result is the same: you can easily use multiple versions of Ruby on the same system. ![]() There are two major ruby version managers in common use: RVM and rbenv. In that case, you will need the assistance of a Ruby version manager to help you manage and move between different Rubies as you switch between different projects. For example, you may be asked to help out with an existing project that has standardized on Ruby version 2.1, but your current local Ruby version is 2.3, which you need to work on your current projects. Software applications tend to standardize on a specific Ruby version in order to guarantee developers don't use unsupported language features. Someday, you will need to install another version of Ruby without removing your current Ruby.Īnother reason to use Ruby version managers is when working on multiple applications. Version 2.3: Added squiggle heredocs ( <<~HERE) Added safe navigation operator ( &.) Added #positive?, #negative?, and #zero? methods to the Numeric class.Īs you can see, every new version has some changes sometimes, programs that run on older versions of Ruby no longer work in more recent versions. Version 2.2: Removed several obsolete libraries. Version 2.0: Added keyword arguments Added %i() syntax for symbol arrays. Version 1.9: Changed block variables to require local variables Introduced syntax for hashes with symbol keys Many incompatible changes. To provide an idea of what might change, here's a short list of some major changes to Ruby over the past few major versions at the time of this writing: Eventually, you're going to write or use a Ruby program that needs a different version of Ruby, and that's when you will find that you need a Ruby version manager. However, this won't always be the case: Ruby is an evolving language with features added, modified, and deleted with every new version. If you do rely on such features, the ones you use all run well in whatever version of Ruby you use, so you're not even aware that you're using version-specific features. Chances are, the programs you've written so far are "version agnostic" that is, they don't rely on features of Ruby that depend on any specific ruby version. If you're just getting started with Ruby, you may wonder why you could possibly need to use more than one version of Ruby. Ruby version managers are programs that let you install, manage, and use multiple versions of Ruby. In this chapter, we will talk about those topics. ![]() Specifically, we did not discuss what ruby version managers are nor what services they provide to a developer who is writing and using Ruby programs. In that discussion, we casually mentioned that ruby version managers play a role in how Ruby uses Gems. In the previous chapter, we discussed RubyGems and how they interact with Ruby and your local file system. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |