Class: Starling::Utils
- Inherits:
-
Object
- Object
- Starling::Utils
- Defined in:
- lib/starling/utils.rb
Overview
A collection of utility methods used across starling-ruby
Class Method Summary collapse
-
.gem_info ⇒ String
The gem’s name and version.
-
.interpreter_version ⇒ String
The JRuby interpreter version this code is currently running on, or the Ruby version for non-JRuby environments.
-
.ruby_engine ⇒ String
The Ruby engine this code is currently running on.
-
.ruby_version ⇒ String
The Ruby version and patchlevel this code is currently running on.
Class Method Details
.gem_info ⇒ String
Returns The gem’s name and version.
6 7 8 9 |
# File 'lib/starling/utils.rb', line 6 def gem_info return 'starling-ruby' unless defined?(Starling::VERSION) "starling-ruby/v#{Starling::VERSION}" end |
.interpreter_version ⇒ String
Returns The JRuby interpreter version this code is currently running on, or the Ruby version for non-JRuby environments.
25 26 27 |
# File 'lib/starling/utils.rb', line 25 def interpreter_version defined?(JRUBY_VERSION) ? JRUBY_VERSION : RUBY_VERSION end |
.ruby_engine ⇒ String
Returns The Ruby engine this code is currently running on.
12 13 14 |
# File 'lib/starling/utils.rb', line 12 def ruby_engine defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' end |
.ruby_version ⇒ String
Returns The Ruby version and patchlevel this code is currently running on.
18 19 20 21 |
# File 'lib/starling/utils.rb', line 18 def ruby_version return RUBY_VERSION unless defined?(RUBY_PATCHLEVEL) RUBY_VERSION + "p#{RUBY_PATCHLEVEL}" end |