Module: Graphiti::Resource::Configuration::Overrides
- Defined in:
- lib/graphiti/resource/configuration.rb
Constant Summary collapse
- BELONGS_TO_RESOURCE_IDS_VALUES =
[:foreign_key, :always, :never].freeze
Instance Method Summary collapse
-
#adapter=(val) ⇒ Object
The .stat call stores a proc based on adapter So if we assign a new adapter, reconfigure.
- #belongs_to_resource_ids_by_default=(val) ⇒ Object
- #graphql_entrypoint=(val) ⇒ Object
- #model ⇒ Object
- #polymorphic=(klasses) ⇒ Object
- #polymorphic? ⇒ Boolean
- #remote=(val) ⇒ Object
- #serializer=(val) ⇒ Object
- #type=(val) ⇒ Object
Instance Method Details
#adapter=(val) ⇒ Object
The .stat call stores a proc based on adapter So if we assign a new adapter, reconfigure
55 56 57 58 |
# File 'lib/graphiti/resource/configuration.rb', line 55 def adapter=(val) super stat total: [:count] end |
#belongs_to_resource_ids_by_default=(val) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/graphiti/resource/configuration.rb', line 11 def belongs_to_resource_ids_by_default=(val) unless BELONGS_TO_RESOURCE_IDS_VALUES.include?(val) raise Errors::InvalidBelongsToResourceIds.new(self, val) end super end |
#graphql_entrypoint=(val) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/graphiti/resource/configuration.rb', line 45 def graphql_entrypoint=(val) if val super(val.to_s.camelize(:lower).to_sym) else super end end |
#model ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/graphiti/resource/configuration.rb', line 72 def model klass = super unless klass || abstract_class? if (klass = infer_model) self.model = klass else raise Errors::ModelNotFound.new(self) end end klass end |
#polymorphic=(klasses) ⇒ Object
29 30 31 32 |
# File 'lib/graphiti/resource/configuration.rb', line 29 def polymorphic=(klasses) super send(:prepend, Polymorphism) end |
#polymorphic? ⇒ Boolean
34 35 36 |
# File 'lib/graphiti/resource/configuration.rb', line 34 def polymorphic? polymorphic.present? end |
#remote=(val) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/graphiti/resource/configuration.rb', line 60 def remote=(val) super include ::Graphiti::Resource::Remote self.endpoint = { path: val, full_path: val, url: val, actions: [:index, :show] } end |
#serializer=(val) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/graphiti/resource/configuration.rb', line 19 def serializer=(val) if val if super(Class.new(val)) apply_attributes_to_serializer end else super end end |
#type=(val) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/graphiti/resource/configuration.rb', line 38 def type=(val) val = val&.to_sym if (val = super) serializer.type(val) end end |