Class: Pageflow::CustomizedTheme Private

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/models/pageflow/customized_theme.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theme, overrides, files) ⇒ CustomizedTheme

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CustomizedTheme.



4
5
6
7
8
# File 'app/models/pageflow/customized_theme.rb', line 4

def initialize(theme, overrides, files)
  super(theme)
  @options = __getobj__.options.deep_merge(overrides || {})
  @files = files
end

Instance Attribute Details

#filesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'app/models/pageflow/customized_theme.rb', line 10

def files
  @files
end

#optionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'app/models/pageflow/customized_theme.rb', line 10

def options
  @options
end

Class Method Details

.build(entry:, theme:, theme_customization:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/pageflow/customized_theme.rb', line 23

def self.build(entry:, theme:, theme_customization:)
  config = Pageflow.config_for(entry)

  new(theme,
      config.transform_theme_customization_overrides.call(
        theme_customization.overrides,
        entry: entry,
        theme: theme
      ),
      config.transform_theme_customization_files.call(
        theme_customization.selected_files.transform_values(&:urls),
        entry: entry,
        theme: theme
      ))
end

.find(entry:, theme:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
17
18
19
20
21
# File 'app/models/pageflow/customized_theme.rb', line 12

def self.find(entry:, theme:)
  build(
    entry: entry,
    theme: theme,
    theme_customization: Pageflow.theme_customizations.get(
      site: entry.site,
      entry_type_name: entry.type_name
    )
  )
end