module RubyVersion
Constants
- VERSION
Public Class Methods
<=>(other)
click to toggle source
comparable
# File lib/ruby_version.rb, line 14 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 114 def description RUBY_DESCRIPTION end
is?(other = nil)
click to toggle source
chaining for dsl-like language
# File lib/ruby_version.rb, line 33 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 85 def major RUBY_VERSION.to_i end
Also aliased as: main
minor()
click to toggle source
# File lib/ruby_version.rb, line 90 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 60 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 53 def not(other) self != other end
Also aliased as: not?
older_than(other)
click to toggle source
# File lib/ruby_version.rb, line 69 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 101 def patchlevel RUBY_PATCHLEVEL end
platform()
click to toggle source
# File lib/ruby_version.rb, line 105 def platform RUBY_PLATFORM end
release_date()
click to toggle source
# File lib/ruby_version.rb, line 109 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 78 def released_today RubyVersion.date == Date.today end
Also aliased as: released_today?
revision()
click to toggle source
# File lib/ruby_version.rb, line 118 def revision defined?(RUBY_REVISION) && RUBY_REVISION end
tiny()
click to toggle source
# File lib/ruby_version.rb, line 95 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 8 def to_s RUBY_VERSION end
Also aliased as: inspect