module RubyVersion
Constants
- VERSION
Public Class Methods
Source
# 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
comparable
Source
# File lib/ruby_version.rb, line 35 def is?(other = nil) if other RubyVersion == other else RubyVersion end end
chaining for dsl-like language
Also aliased as: is
Source
# File lib/ruby_version.rb, line 87 def major RUBY_VERSION.to_i end
accessors
Also aliased as: main
Source
# File lib/ruby_version.rb, line 92 def minor RUBY_VERSION.split('.')[1].to_i end
Also aliased as: mini
Source
# 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
compare dates
Also aliased as: newer_than?
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?
Source
# File lib/ruby_version.rb, line 111 def release_date Date.parse RUBY_RELEASE_DATE end
Also aliased as: date
Source
# File lib/ruby_version.rb, line 80 def released_today RubyVersion.date == Date.today end
Also aliased as: released_today?
Source
# File lib/ruby_version.rb, line 120 def revision defined?(RUBY_REVISION) && RUBY_REVISION end
Source
# File lib/ruby_version.rb, line 97 def tiny RUBY_VERSION.split('.')[2].to_i end
Also aliased as: teeny