Method: System::Ruby.version?

Defined in:
lib/system/ruby.rb

.version?TrueClass, FalseClass

Return if we have information about the version.

Examples:

System::Ruby.version # => "2012-10-12"
System::Ruby.version? # => true

Since:

  • 0.1.3



178
179
180
181
182
183
184
185
186
# File 'lib/system/ruby.rb', line 178

Object.constants.grep(/^RUBY_/).each do |const_name|
  method_name = const_name.to_s.gsub(/^RUBY_/, '').downcase.to_sym
  
  define_method(method_name) do
    Object.const_defined?(const_name) ? Object.const_get(const_name) : nil
  end
  
  define_method("#{method_name}?") { !send(method_name).nil? }
end