module RSpec::Support::RubyFeatures

@api private

Provides query methods for ruby features that differ among implementations.

Public Instance Methods

caller_locations_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 83
def caller_locations_supported?
  respond_to?(:caller_locations, true)
end
foo() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 170
def foo; end
fork_supported?() click to toggle source

On JRuby 1.7 `–1.8` mode, `Process.respond_to?(:fork)` returns true, but when you try to fork, it raises an error:

NotImplementedError: fork is not available on this platform

When we drop support for JRuby 1.7 and/or Ruby 1.8, we can drop this special case.

# File lib/rspec/support/ruby_features.rb, line 70
def fork_supported?
  false
end
kw_args_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 130
def kw_args_supported?
  RUBY_VERSION >= '2.0.0'
end
module_prepends_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 186
def module_prepends_supported?
  Module.method_defined?(:prepend) || Module.private_method_defined?(:prepend)
end
module_refinement_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 182
def module_refinement_supported?
  Module.method_defined?(:refine) || Module.private_method_defined?(:refine)
end
optional_and_splat_args_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 79
def optional_and_splat_args_supported?
  Method.method_defined?(:parameters)
end
required_kw_args_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 134
def required_kw_args_supported?
  RUBY_VERSION >= '2.1.0'
end
ripper_supported?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 120
def ripper_supported?
  true
end
supports_exception_cause?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 88
def supports_exception_cause?
  true
end
supports_rebinding_module_methods?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 138
def supports_rebinding_module_methods?
  RUBY_VERSION.to_i >= 2
end
supports_taint?() click to toggle source
# File lib/rspec/support/ruby_features.rb, line 98
def supports_taint?
  false
end