Class: PufferPages::Backends::Snippet

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ActiveUUID::UUID, Mixins::Importable, Mixins::Renderable, Mixins::Translatable
Defined in:
lib/puffer_pages/backends/models/snippet.rb

Direct Known Subclasses

Snippet

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::Renderable

#template

Class Method Details

.find_snippet(name) ⇒ Object



14
15
16
# File 'lib/puffer_pages/backends/models/snippet.rb', line 14

def self.find_snippet(name)
  where(:name => name).first
end

Instance Method Details

#additional_render_optionsObject



23
24
25
# File 'lib/puffer_pages/backends/models/snippet.rb', line 23

def additional_render_options
  { environment: { processed: self } }
end

#i18n_defaultsObject



31
32
33
# File 'lib/puffer_pages/backends/models/snippet.rb', line 31

def i18n_defaults
  []
end

#i18n_scopeObject



27
28
29
# File 'lib/puffer_pages/backends/models/snippet.rb', line 27

def i18n_scope
  [:snippets, name.to_sym]
end

#render(*args) ⇒ Object



18
19
20
21
# File 'lib/puffer_pages/backends/models/snippet.rb', line 18

def render *args
  _, context = normalize_render_options *args
  render_template body, context, additional_render_options
end