Module: GraphQL::Types::Relay::EdgeBehaviors::ClassMethods
- Defined in:
- lib/graphql/types/relay/edge_behaviors.rb
Instance Method Summary collapse
-
#accessible?(ctx) ⇒ Boolean
-
#authorized?(obj, ctx) ⇒ Boolean
-
#node_nullable(new_value = nil) ⇒ Object
Set the default
node_nullable
for this class and its child classes. -
#node_type(node_type = nil, null: self.node_nullable) ⇒ Object
Get or set the Object type that this edge wraps.
-
#visible?(ctx) ⇒ Boolean
Instance Method Details
#accessible?(ctx) ⇒ Boolean
32 33 34 |
# File 'lib/graphql/types/relay/edge_behaviors.rb', line 32 def accessible?(ctx) node_type.accessible?(ctx) end |
#authorized?(obj, ctx) ⇒ Boolean
28 29 30 |
# File 'lib/graphql/types/relay/edge_behaviors.rb', line 28 def (obj, ctx) true end |
#node_nullable(new_value = nil) ⇒ Object
Set the default node_nullable
for this class and its child classes. (Defaults to true
.)
Use node_nullable(false)
in your base class to make non-null node
field.
42 43 44 45 46 47 48 |
# File 'lib/graphql/types/relay/edge_behaviors.rb', line 42 def node_nullable(new_value = nil) if new_value.nil? defined?(@node_nullable) ? @node_nullable : superclass.node_nullable else @node_nullable = new_value end end |
#node_type(node_type = nil, null: self.node_nullable) ⇒ Object
Get or set the Object type that this edge wraps.
19 20 21 22 23 24 25 26 |
# File 'lib/graphql/types/relay/edge_behaviors.rb', line 19 def node_type(node_type = nil, null: self.node_nullable) if node_type @node_type = node_type # Add a default `node` field field :node, node_type, null: null, description: "The item at the end of the edge.", connection: false end @node_type end |
#visible?(ctx) ⇒ Boolean
36 37 38 |
# File 'lib/graphql/types/relay/edge_behaviors.rb', line 36 def visible?(ctx) node_type.visible?(ctx) end |