Class: SkeletonLoader::SkeletonElementGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/skeleton_loader/skeleton_element_generator.rb

Overview

Generates skeleton loader element

Class Method Summary collapse

Class Method Details

.generate(content_id:, options: {}, context: :view, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/skeleton_loader/skeleton_element_generator.rb', line 9

def generate(content_id:, options: {}, context: :view, &block)
  validate_content_id!(content_id)
  content = generate_content(options, &block)

  css_class = context == :controller ? "skeleton-loader--client" : "skeleton-loader--server"
  wrap_content(content, content_id, css_class)
end