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 <<-RUBY
    def #{method_name}(*args)
      if block_given?
        #{accessor}.#{method_name}(*args, &Proc.new)
      else
        #{accessor}.#{method_name}(*args)
      end
    end
    RUBY
  end
end