Class: GraphQLIncludable::Relay::EdgeWithNode

Inherits:
GraphQL::Relay::Edge
  • Object
show all
Defined in:
lib/graphql_includable/relay/edge_with_node.rb

Instance Method Summary collapse

Constructor Details

#initialize(node, connection) ⇒ EdgeWithNode



4
5
6
7
8
9
# File 'lib/graphql_includable/relay/edge_with_node.rb', line 4

def initialize(node, connection)
  @edge = node
  edge_to_node_property = connection.field.type.fields['edges'].[:edge_to_node_property]
  node = @edge.public_send(edge_to_node_property)
  super(node, connection)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/graphql_includable/relay/edge_with_node.rb', line 11

def method_missing(method_name, *args, &block)
  if @edge.respond_to?(method_name)
    @edge.send(method_name, *args, &block)
  else
    super
  end
end

Instance Method Details

#respond_to_missing(method_name, include_private = false) ⇒ Object



19
20
21
# File 'lib/graphql_includable/relay/edge_with_node.rb', line 19

def respond_to_missing(method_name, include_private = false)
  @edge.respond_to?(method_name) || super
end