Module: Graphiti::Resource::Configuration::Overrides

Defined in:
lib/graphiti/resource/configuration.rb

Instance Method Summary collapse

Instance Method Details

#adapter=(val) ⇒ Object

The .stat call stores a proc based on adapter So if we assign a new adapter, reconfigure



41
42
43
44
# File 'lib/graphiti/resource/configuration.rb', line 41

def adapter=(val)
  super
  stat total: [:count]
end

#graphql_entrypoint=(val) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/graphiti/resource/configuration.rb', line 31

def graphql_entrypoint=(val)
  if val
    super(val.to_s.camelize(:lower).to_sym)
  else
    super
  end
end

#modelObject



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/graphiti/resource/configuration.rb', line 57

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



19
20
21
22
# File 'lib/graphiti/resource/configuration.rb', line 19

def polymorphic=(klasses)
  super
  send(:prepend, Polymorphism)
end

#remote=(val) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/graphiti/resource/configuration.rb', line 46

def remote=(val)
  super
  include ::Graphiti::Resource::Remote
  self.endpoint = {
    path: val,
    full_path: val,
    url: val,
    actions: [:index, :show]
  }
end

#serializer=(val) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/graphiti/resource/configuration.rb', line 9

def serializer=(val)
  if val
    if super(Class.new(val))
      apply_attributes_to_serializer
    end
  else
    super
  end
end

#type=(val) ⇒ Object



24
25
26
27
28
29
# File 'lib/graphiti/resource/configuration.rb', line 24

def type=(val)
  val = val&.to_sym
  if (val = super)
    serializer.type(val)
  end
end