Module: Quandl::Utility::RubyVersion
- Extended by:
- Comparable
- Defined in:
- lib/quandl/utility/ruby_version.rb
Class Method Summary collapse
-
.<=>(other) ⇒ Object
comparable.
- .description ⇒ Object
- .full_version ⇒ Object
-
.is?(other = nil) ⇒ Boolean
(also: is)
chaining for dsl-like language.
-
.major ⇒ Object
(also: main)
accessors.
- .minor ⇒ Object (also: mini)
-
.newer_than(other) ⇒ Object
(also: newer_than?)
compare dates.
- .not(other) ⇒ Object (also: not?)
- .older_than(other) ⇒ Object (also: older_than?)
- .patchlevel ⇒ Object
- .platform ⇒ Object
- .release_date ⇒ Object (also: date)
- .released_today ⇒ Object (also: released_today?)
- .tiny ⇒ Object (also: teeny)
- .to_s ⇒ Object
Class Method Details
.<=>(other) ⇒ Object
comparable
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/quandl/utility/ruby_version.rb', line 37 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 ⇒ Object
137 138 139 |
# File 'lib/quandl/utility/ruby_version.rb', line 137 def description RUBY_DESCRIPTION end |
.full_version ⇒ Object
32 33 34 |
# File 'lib/quandl/utility/ruby_version.rb', line 32 def full_version "#{RUBY_VERSION}-p#{patchlevel}" end |
.is?(other = nil) ⇒ Boolean Also known as: is
chaining for dsl-like language
56 57 58 59 60 61 62 |
# File 'lib/quandl/utility/ruby_version.rb', line 56 def is?(other = nil) if other RubyVersion == other else RubyVersion end end |
.major ⇒ Object Also known as: main
accessors
108 109 110 |
# File 'lib/quandl/utility/ruby_version.rb', line 108 def major RUBY_VERSION.to_i end |
.minor ⇒ Object Also known as: mini
113 114 115 |
# File 'lib/quandl/utility/ruby_version.rb', line 113 def minor RUBY_VERSION.split('.')[1].to_i end |
.newer_than(other) ⇒ Object Also known as: newer_than?
compare dates
83 84 85 86 87 88 89 |
# File 'lib/quandl/utility/ruby_version.rb', line 83 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 |
.not(other) ⇒ Object Also known as: not?
76 77 78 |
# File 'lib/quandl/utility/ruby_version.rb', line 76 def not(other) self != other end |
.older_than(other) ⇒ Object Also known as: older_than?
92 93 94 95 96 97 98 |
# File 'lib/quandl/utility/ruby_version.rb', line 92 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 |
.patchlevel ⇒ Object
124 125 126 |
# File 'lib/quandl/utility/ruby_version.rb', line 124 def patchlevel RUBY_PATCHLEVEL end |
.platform ⇒ Object
128 129 130 |
# File 'lib/quandl/utility/ruby_version.rb', line 128 def platform RUBY_PLATFORM end |
.release_date ⇒ Object Also known as: date
132 133 134 |
# File 'lib/quandl/utility/ruby_version.rb', line 132 def release_date Date.parse RUBY_RELEASE_DATE end |
.released_today ⇒ Object Also known as: released_today?
101 102 103 |
# File 'lib/quandl/utility/ruby_version.rb', line 101 def released_today RubyVersion.date == Date.today end |
.tiny ⇒ Object Also known as: teeny
118 119 120 |
# File 'lib/quandl/utility/ruby_version.rb', line 118 def tiny RUBY_VERSION.split('.')[2].to_i end |
.to_s ⇒ Object
28 29 30 |
# File 'lib/quandl/utility/ruby_version.rb', line 28 def to_s RUBY_VERSION end |