Sha256: 0e7cd4599495fcc77fb4b40a6f346bac3e6f3119237da4b95602830a632133be

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

module RSpec
  module Support
    # @api private
    #
    # Provides query methods for ruby features that differ among
    # implementations.
    module RubyFeatures
      def optional_and_splat_args_supported?
        Method.method_defined?(:parameters)
      end
      module_function :optional_and_splat_args_supported?

      def kw_args_supported?
        RUBY_VERSION >= '2.0.0' && RUBY_ENGINE != 'rbx' && RUBY_ENGINE != 'jruby'
      end
      module_function :kw_args_supported?

      def required_kw_args_supported?
        RUBY_VERSION >= '2.1.0' && RUBY_ENGINE != 'rbx' && RUBY_ENGINE != 'jruby'
      end
      module_function :required_kw_args_supported?

      def module_prepends_supported?
        Module.private_method_defined?(:prepend)
      end
      module_function :module_prepends_supported?

      def supports_rebinding_module_methods?
        # RBX and JRuby don't yet support this.
        RUBY_VERSION.to_i >= 2 && RUBY_ENGINE != 'rbx' && RUBY_ENGINE != 'jruby'
      end
      module_function :supports_rebinding_module_methods?
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rspec-support-3.0.2 lib/rspec/support/ruby_features.rb
rspec-support-3.0.1 lib/rspec/support/ruby_features.rb
whos_dated_who-0.1.0 vendor/bundle/gems/rspec-support-3.0.0/lib/rspec/support/ruby_features.rb
whos_dated_who-0.0.1 vendor/bundle/gems/rspec-support-3.0.0/lib/rspec/support/ruby_features.rb
rspec-support-3.0.0 lib/rspec/support/ruby_features.rb