module RubyVersion
Constants
- VERSION
Public Class Methods
<=>(other)
click to toggle source
comparable
# File lib/ruby_version.rb, line 15 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 115 def description RUBY_DESCRIPTION end
is?(other = nil)
click to toggle source
chaining for dsl-like language
# File lib/ruby_version.rb, line 34 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 86 def major RUBY_VERSION.to_i end
Also aliased as: main
minor()
click to toggle source
# File lib/ruby_version.rb, line 91 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 61 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 54 def not(other) self != other end
Also aliased as: not?
older_than(other)
click to toggle source
# File lib/ruby_version.rb, line 70 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 102 def patchlevel RUBY_PATCHLEVEL end
platform()
click to toggle source
# File lib/ruby_version.rb, line 106 def platform RUBY_PLATFORM end
release_date()
click to toggle source
# File lib/ruby_version.rb, line 110 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 79 def released_today RubyVersion.date == Date.today end
Also aliased as: released_today?
revision()
click to toggle source
# File lib/ruby_version.rb, line 119 def revision defined?(RUBY_REVISION) && RUBY_REVISION end
tiny()
click to toggle source
# File lib/ruby_version.rb, line 96 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 9 def to_s RUBY_VERSION end
Also aliased as: inspect