Module: RuboCop::SimpleForwardable
- Included in:
- AST::CollectionNode, AST::NodePattern, AST::NodePattern::Compiler, AST::NodePattern::Node, AST::NodePattern::Parser
- Defined in:
- lib/rubocop/ast/utilities/simple_forwardable.rb
Overview
Similar to ‘Forwardable#def_delegators`, but simpler & faster
Instance Method Summary collapse
Instance Method Details
#def_delegators(accessor, *methods) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/rubocop/ast/utilities/simple_forwardable.rb', line 6 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 |