Sha256: 193d0cd0bf4132f549447f0445c2f2a865e06cc9f5e991d555e2a570635166ff

Contents?: true

Size: 1.34 KB

Versions: 24

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

module GraphQL
  class Schema
    class Member
      module RelayShortcuts
        def edge_type_class(new_edge_type_class = nil)
          if new_edge_type_class
            @edge_type_class = new_edge_type_class
          else
            @edge_type_class || find_inherited_method(:edge_type_class, Types::Relay::BaseEdge)
          end
        end

        def connection_type_class(new_connection_type_class = nil)
          if new_connection_type_class
            @connection_type_class = new_connection_type_class
          else
            @connection_type_class || find_inherited_method(:connection_type_class, Types::Relay::BaseConnection)
          end
        end

        def edge_type
          @edge_type ||= begin
            edge_name = self.graphql_name + "Edge"
            node_type_class = self
            Class.new(edge_type_class) do
              graphql_name(edge_name)
              node_type(node_type_class)
            end
          end
        end

        def connection_type
          @connection_type ||= begin
            conn_name = self.graphql_name + "Connection"
            edge_type_class = self.edge_type
            Class.new(connection_type_class) do
              graphql_name(conn_name)
              edge_type(edge_type_class)
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
graphql-1.8.18 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.7 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.6 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.5 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.4 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.3 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.2 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.17 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.16 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.1 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.0 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.15 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.0.pre4 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.14 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.0.pre3 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.0.pre2 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.13 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.12 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.9.0.pre1 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.8.11 lib/graphql/schema/member/relay_shortcuts.rb