Module: Graphiti::Resource::Configuration::Overrides
- Includes:
- DslReaders
- Defined in:
- lib/graphiti/resource/configuration.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#adapter=(val) ⇒ Object
The .stat call stores a proc based on adapter So if we assign a new adapter, reconfigure.
- #graphql_entrypoint=(val) ⇒ Object
- #model(value = UNSET) ⇒ Object
- #model=(val) ⇒ 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
135 136 137 138 139 |
# File 'lib/graphiti/resource/configuration.rb', line 135 def adapter=(val) val = Adapters.const_get(Adapters.constants.find { |name| name.to_s.underscore == val.to_s }) if val.is_a?(Symbol) super stat total: [:count] end |
#graphql_entrypoint=(val) ⇒ Object
125 126 127 128 129 130 131 |
# File 'lib/graphiti/resource/configuration.rb', line 125 def graphql_entrypoint=(val) if val super(val.to_s.camelize(:lower).to_sym) else super end end |
#model(value = UNSET) ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/graphiti/resource/configuration.rb', line 159 def model(value = UNSET) return public_send(:model=, value) unless value.equal?(UNSET) klass = super() unless klass || abstract_class? if (klass = infer_model) self.model = klass else raise Errors::ModelNotFound.new(self) end end klass end |
#model=(val) ⇒ Object
153 154 155 156 157 |
# File 'lib/graphiti/resource/configuration.rb', line 153 def model=(val) super apply_public_id if publishes_public_id? config[:sideloads].each_value { |sideload| sideload.register_public_id_source if eagerly_apply_sideload?(sideload) } end |
#polymorphic=(klasses) ⇒ Object
109 110 111 112 |
# File 'lib/graphiti/resource/configuration.rb', line 109 def polymorphic=(klasses) super send(:prepend, Polymorphism) end |
#polymorphic? ⇒ Boolean
114 115 116 |
# File 'lib/graphiti/resource/configuration.rb', line 114 def polymorphic? polymorphic.present? end |
#remote=(val) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/graphiti/resource/configuration.rb', line 141 def remote=(val) super include ::Graphiti::Resource::Remote self.endpoint = { path: val, full_path: val, url: val, actions: [:index, :show] } end |
#serializer=(val) ⇒ Object
99 100 101 102 103 104 105 106 107 |
# File 'lib/graphiti/resource/configuration.rb', line 99 def serializer=(val) if val if super(Class.new(val)) apply_attributes_to_serializer end else super end end |
#type=(val) ⇒ Object
118 119 120 121 122 123 |
# File 'lib/graphiti/resource/configuration.rb', line 118 def type=(val) val = val&.to_sym if (val = super) serializer.type(val) end end |