17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/deface/action_view_extensions.rb', line 17
def encode!
return super unless Rails.application.config.deface.enabled
source = Deface.before_rails_6? ? (super; @source) : super
syntax = Deface::ActionViewExtensions.determine_syntax(@handler)
overrides = Deface::Override.find(
locals: @locals,
format: @format,
variant: @variant,
virtual_path: @virtual_path,
)
if syntax && overrides.any?
@updated_at = Time.now if Deface.before_rails_6?
@handler = ActionView::Template::Handlers::ERB
new_source = Deface::Override.apply_overrides(
Deface::Override.convert_source(source, syntax: syntax),
overrides: overrides
)
if Deface.before_rails_6?
@source.replace new_source
else
source.replace new_source
end
end
source
end
|