mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Add List The Running Ruby Version as a ruby til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
||||||
|
|
||||||
_1037 TILs and counting..._
|
_1038 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -844,6 +844,7 @@ _1037 TILs and counting..._
|
|||||||
- [Jump Out Of A Nested Context With Throw/Catch](ruby/jump-out-of-a-nested-context-with-throw-catch.md)
|
- [Jump Out Of A Nested Context With Throw/Catch](ruby/jump-out-of-a-nested-context-with-throw-catch.md)
|
||||||
- [Last Raised Exception In The Call Stack](ruby/last-raised-exception-in-the-call-stack.md)
|
- [Last Raised Exception In The Call Stack](ruby/last-raised-exception-in-the-call-stack.md)
|
||||||
- [Limit Split](ruby/limit-split.md)
|
- [Limit Split](ruby/limit-split.md)
|
||||||
|
- [List The Running Ruby Version](ruby/list-the-running-ruby-version.md)
|
||||||
- [Listing Local Variables](ruby/listing-local-variables.md)
|
- [Listing Local Variables](ruby/listing-local-variables.md)
|
||||||
- [Map With Index Over An Array](ruby/map-with-index-over-an-array.md)
|
- [Map With Index Over An Array](ruby/map-with-index-over-an-array.md)
|
||||||
- [Mock Method Chain Calls With RSpec](ruby/mock-method-chain-calls-with-rspec.md)
|
- [Mock Method Chain Calls With RSpec](ruby/mock-method-chain-calls-with-rspec.md)
|
||||||
|
|||||||
16
ruby/list-the-running-ruby-version.md
Normal file
16
ruby/list-the-running-ruby-version.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# List The Running Ruby Version
|
||||||
|
|
||||||
|
The running Ruby version can be listed with the `RUBY_VERSION` constant.
|
||||||
|
|
||||||
|
For instance, if my Ruby version is 3.0.0, then I could get the version like
|
||||||
|
so:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
> RUBY_VERSION
|
||||||
|
=> "3.0.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
This is nice if you just want to check in an IRB session or if you need it as
|
||||||
|
part of a script.
|
||||||
|
|
||||||
|
[source](https://blog.arkency.com/which-ruby-version-am-i-using-how-to-check/)
|
||||||
Reference in New Issue
Block a user