module RubyVersion
Constants
- VERSION
Public Class Methods
<=>(other)
click to toggle source
comparable
# File lib/ruby_version.rb, line 16 def <=>(other) value = case other when Integer RUBY_VERSION.to_i when Float RUBY_VERSION.to_f when String RUBY_VERSION when Date, Time other.class.parse(RUBY_RELEASE_DATE) else other = other.to_s RUBY_VERSION end value <=> other end
description()
click to toggle source
# File lib/ruby_version.rb, line 116 def description RUBY_DESCRIPTION end
is?(other = nil)
click to toggle source
chaining for dsl-like language
# File lib/ruby_version.rb, line 35 def is?(other = nil) if other RubyVersion == other else RubyVersion end end
Also aliased as: is
major()
click to toggle source
accessors
# File lib/ruby_version.rb, line 87 def major RUBY_VERSION.to_i end
Also aliased as: main
minor()
click to toggle source
# File lib/ruby_version.rb, line 92 def minor RUBY_VERSION.split('.')[1].to_i end
Also aliased as: mini
newer_than(other)
click to toggle source
compare dates
# File lib/ruby_version.rb, line 62 def newer_than(other) if other.is_a? Date or other.is_a? Time RubyVersion > other else RUBY_RELEASE_DATE > other.to_s end end
Also aliased as: newer_than?
not(other)
click to toggle source
# File lib/ruby_version.rb, line 55 def not(other) self != other end
Also aliased as: not?
older_than(other)
click to toggle source
# File lib/ruby_version.rb, line 71 def older_than(other) if other.is_a? Date or other.is_a? Time RubyVersion < other else RUBY_RELEASE_DATE < other.to_s end end
Also aliased as: older_than?
patchlevel()
click to toggle source
# File lib/ruby_version.rb, line 103 def patchlevel RUBY_PATCHLEVEL end
platform()
click to toggle source
# File lib/ruby_version.rb, line 107 def platform RUBY_PLATFORM end
release_date()
click to toggle source
# File lib/ruby_version.rb, line 111 def release_date Date.parse RUBY_RELEASE_DATE end
Also aliased as: date
released_today()
click to toggle source
# File lib/ruby_version.rb, line 80 def released_today RubyVersion.date == Date.today end
Also aliased as: released_today?
revision()
click to toggle source
# File lib/ruby_version.rb, line 120 def revision defined?(RUBY_REVISION) && RUBY_REVISION end
tiny()
click to toggle source
# File lib/ruby_version.rb, line 97 def tiny RUBY_VERSION.split('.')[2].to_i end
Also aliased as: teeny
to_s()
click to toggle source
# File lib/ruby_version.rb, line 10 def to_s RUBY_VERSION end
Also aliased as: inspect