Sha256: 47f76524a7d4e91c8e85391f38ccbc8d06d3bcb206c5c6ad54989fd24aa17858

Contents?: true

Size: 469 Bytes

Versions: 11

Compression:

Stored size: 469 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  # Similar to `Forwardable#def_delegators`, but simpler & faster
  module SimpleForwardable
    def def_delegators(accessor, *methods)
      methods.each do |method|
        class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
          def #{method}(...)           # def example(...)
            #{accessor}.#{method}(...) #   foo.example(...)
          end                          # end
        RUBY
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rubocop-ast-1.37.0 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.36.2 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.36.1 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.36.0 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.35.0 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.34.1 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.34.0 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.33.1 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.33.0 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.32.3 lib/rubocop/ast/utilities/simple_forwardable.rb
rubocop-ast-1.32.2 lib/rubocop/ast/utilities/simple_forwardable.rb