Sha256: 59e3360107fe069c31575ca1985641d35a1324c4b7f2645947529d24186c4ceb

Contents?: true

Size: 659 Bytes

Versions: 6885

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for working with heredoc strings.
    module Heredoc
      OPENING_DELIMITER = /(<<[~-]?)['"`]?([^'"`]+)['"`]?/.freeze

      def on_str(node)
        return unless node.heredoc?

        on_heredoc(node)
      end
      alias on_dstr on_str
      alias on_xstr on_str

      def on_heredoc(_node)
        raise NotImplementedError
      end

      private

      def delimiter_string(node)
        node.source.match(OPENING_DELIMITER).captures[1]
      end

      def heredoc_type(node)
        node.source.match(OPENING_DELIMITER).captures[0]
      end
    end
  end
end

Version data entries

6,885 entries across 6,859 versions & 31 rubygems

Version Path
cybrid_api_bank_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_id_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_organization_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_bank_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_id_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_organization_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_bank_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_organization_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_id_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
ory-client-1.16.2 vendor/bundle/ruby/3.1.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_bank_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_organization_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_id_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_bank_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_id_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_organization_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
ory-client-1.16.1 vendor/bundle/ruby/3.1.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
ory-client-1.16.0 vendor/bundle/ruby/3.1.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb
cybrid_api_bank_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/heredoc.rb