Class: Starling::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/starling/utils.rb

Overview

A collection of utility methods used across starling-ruby

Class Method Summary collapse

Class Method Details

.gem_infoString

Returns The gem's name and version.

Returns:

  • (String)

    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_versionString

Returns The JRuby interpreter version this code is currently running on, or the Ruby version for non-JRuby environments.

Returns:

  • (String)

    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_engineString

Returns The Ruby engine this code is currently running on.

Returns:

  • (String)

    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_versionString

Returns The Ruby version and patchlevel this code is currently running on.

Returns:

  • (String)

    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