Module: GraphQL::Delegate

Overview

Ruby stdlib was pretty busted until this fix: https://bugs.ruby-lang.org/issues/13111 https://github.com/ruby/ruby/commit/46c0e79bb5b96c45c166ef62f8e585f528862abb#diff-43adf0e587a50dbaf51764a262008d40

Instance Method Summary collapse

Instance Method Details

#def_delegators(accessor, *method_names) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/graphql.rb', line 13

def def_delegators(accessor, *method_names)
  method_names.each do |method_name|
    class_eval "def \#{method_name}(*args)\nif block_given?\n\#{accessor}.\#{method_name}(*args, &Proc.new)\nelse\n\#{accessor}.\#{method_name}(*args)\nend\nend\n"
  end
end