Sha256: 8a728788f2208959e37acb8d109e8e2ab62eb6b8ddecfbdceae94ac7c48dc3b3

Contents?: true

Size: 812 Bytes

Versions: 69

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module RSpec
    # Wrapper for RSpec examples
    class Example < Concept
      # @!method extract_doc_string(node)
      def_node_matcher :extract_doc_string,     '(send _ _ $_ ...)'

      # @!method extract_metadata(node)
      def_node_matcher :extract_metadata,       '(send _ _ _ $...)'

      # @!method extract_implementation(node)
      def_node_matcher :extract_implementation, '(block send args $_)'

      def doc_string
        extract_doc_string(definition)
      end

      def metadata
        extract_metadata(definition)
      end

      def implementation
        extract_implementation(node)
      end

      def definition
        if node.send_type?
          node
        else
          node.send_node
        end
      end
    end
  end
end

Version data entries

69 entries across 63 versions & 7 rubygems

Version Path
rubocop-rspec-2.27.0 lib/rubocop/rspec/example.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.26.1/lib/rubocop/rspec/example.rb
rubocop-rspec-2.26.1 lib/rubocop/rspec/example.rb
rubocop-rspec-2.26.0 lib/rubocop/rspec/example.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/rspec/example.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/example.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.13.1/lib/rubocop/rspec/example.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/rspec/example.rb
rubocop-rspec-2.25.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.24.1 lib/rubocop/rspec/example.rb
rubocop-rspec-2.24.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.23.2 lib/rubocop/rspec/example.rb
rubocop-rspec-2.23.1 lib/rubocop/rspec/example.rb
rubocop-rspec-2.23.0 lib/rubocop/rspec/example.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/example.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/example.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.13.1/lib/rubocop/rspec/example.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/rspec/example.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/rspec/example.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/example.rb