Class: Stardust::GraphQL::Object
- Inherits:
-
GraphQL::Schema::Object
- Object
- GraphQL::Schema::Object
- Stardust::GraphQL::Object
- Includes:
- ApolloFederation::Object
- Defined in:
- lib/stardust/graphql/object.rb
Class Method Summary collapse
- .field(name, type, description = nil, **kwargs, &block) ⇒ Object
- .implements(type) ⇒ Object
- .replace_types! ⇒ Object
Instance Method Summary collapse
Class Method Details
.field(name, type, description = nil, **kwargs, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/stardust/graphql/object.rb', line 20 def self.field(name, type, description = nil, **kwargs, &block) @__types_to_lookup__ ||= [] @__types_to_lookup__ << ->(klass) { actual_type = Collector.lookup_type(type) klass .method(:field) .super_method .call(name, actual_type, description, **kwargs, &block) } end |
.implements(type) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/stardust/graphql/object.rb', line 8 def self.implements(type) @__types_to_lookup__ ||= [] @__types_to_lookup__ << ->(klass) { actual_type = Collector.lookup_type(type) klass .method(:implements) .super_method .call(actual_type) } end |
.replace_types! ⇒ Object
32 33 34 35 |
# File 'lib/stardust/graphql/object.rb', line 32 def self.replace_types! return unless @__types_to_lookup__ @__types_to_lookup__.each {|lookup| lookup.(self)} end |
Instance Method Details
#current_user ⇒ Object
37 38 39 |
# File 'lib/stardust/graphql/object.rb', line 37 def current_user context[:current_user] end |