Module: GraphQL::Delegate

Overview

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