lib/rails/graphql/field.rb
# A small shared helper method that allows field information to be
# proxied
A small shared helper method that allows field information to be
proxied
A small shared helper method that allows field information to be proxied
def proxyable_methods(*list, klass:, allow_nil: false)
          list = list.flatten.compact.map do |method_name|
            ivar = '@' + method_name.delete_suffix('?')
            accessor = 'field' + (allow_nil ? '&.' : '.') + method_name
            "def #{method_name}; defined?(#{ivar}) ? #{ivar} : #{accessor}; end"
          end
          klass.class_eval(list.join("\n"), __FILE__, __LINE__ + 1)
        end
def proxyable_methods ( * list , klass : , allow_nil : false ) list = list . flatten . compact . map do | method_name | ivar = '@' + method_name . delete_suffix ( '?' ) accessor = 'field' + ( allow_nil ? '&.' : '.' ) + method_name "def #{method_name}; defined?(#{ivar}) ? #{ivar} : #{accessor}; end" end klass . class_eval ( list . join ( "\n" ) , __FILE__ , __LINE__ + 1 ) end
A small shared helper method that allows field information to be
proxied
A small shared helper method that allows field information to be proxied
list
klass
allow_nil