Module: Jat::Plugins::Presenter
- Defined in:
- lib/jat/plugins/presenter/presenter.rb
Defined Under Namespace
Modules: ClassMethods, ResponsePieceInstanceMethods
Classes: Presenter
Class Method Summary
collapse
Class Method Details
.after_load(jat_class, **_opts) ⇒ Object
28
29
30
31
32
|
# File 'lib/jat/plugins/presenter/presenter.rb', line 28
def self.after_load(jat_class, **_opts)
presenter_class = Class.new(Presenter)
presenter_class.jat_class = jat_class
jat_class.const_set(:Presenter, presenter_class)
end
|
.before_load(jat_class, **opts) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/jat/plugins/presenter/presenter.rb', line 13
def self.before_load(jat_class, **opts)
if jat_class.plugin_used?(:json_api)
jat_class.plugin :json_api_preloads, **opts
elsif jat_class.plugin_used?(:simple_api)
jat_class.plugin :simple_api_preloads, **opts
else
raise Error, "Please load :json_api or :simple_api plugin first"
end
end
|
.load(jat_class, **_opts) ⇒ Object
23
24
25
26
|
# File 'lib/jat/plugins/presenter/presenter.rb', line 23
def self.load(jat_class, **_opts)
jat_class.extend(ClassMethods)
jat_class::ResponsePiece.include(ResponsePieceInstanceMethods)
end
|
.plugin_name ⇒ Object
9
10
11
|
# File 'lib/jat/plugins/presenter/presenter.rb', line 9
def self.plugin_name
:presenter
end
|