Class: SkeletonLoader::Configuration
- Inherits:
-
Object
- Object
- SkeletonLoader::Configuration
- Defined in:
- lib/skeleton_loader/configuration.rb
Overview
Configuration class manages settings for the SkeletonLoader gem.
Constant Summary collapse
- TEMPLATE_DEFAULTS =
{ card: { width: 200, count: 3, per_row: 3 }, comment: { width: 900, count: 2, per_row: 1 }, default: { width: 900, count: 1, per_row: 1 }, gallery: { width: 320, count: 3, per_row: 3 }, paragraph: { width: 900, count: 1, per_row: 1 }, product: { width: 320, count: 3, per_row: 3 }, profile: { width: 320, count: 3, per_row: 3 } }.freeze
Instance Attribute Summary collapse
-
#additional_allowed_attributes ⇒ Object
readonly
Returns the value of attribute additional_allowed_attributes.
-
#additional_allowed_css_properties ⇒ Object
readonly
Returns the value of attribute additional_allowed_css_properties.
-
#additional_allowed_tags ⇒ Object
readonly
Returns the value of attribute additional_allowed_tags.
-
#animation_type ⇒ Object
readonly
Returns the value of attribute animation_type.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
-
#template_paths ⇒ Object
readonly
Returns the value of attribute template_paths.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
- #base_options ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ Object
Resets all configuration options to their defaults.
-
#template_defaults_for(type) ⇒ Object
Returns the default options for a specific template type.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 |
# File 'lib/skeleton_loader/configuration.rb', line 20 def initialize reset! end |
Instance Attribute Details
#additional_allowed_attributes ⇒ Object (readonly)
Returns the value of attribute additional_allowed_attributes.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def additional_allowed_attributes @additional_allowed_attributes end |
#additional_allowed_css_properties ⇒ Object (readonly)
Returns the value of attribute additional_allowed_css_properties.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def additional_allowed_css_properties @additional_allowed_css_properties end |
#additional_allowed_tags ⇒ Object (readonly)
Returns the value of attribute additional_allowed_tags.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def @additional_allowed_tags end |
#animation_type ⇒ Object (readonly)
Returns the value of attribute animation_type.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def animation_type @animation_type end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def scale @scale end |
#template_paths ⇒ Object (readonly)
Returns the value of attribute template_paths.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def template_paths @template_paths end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
16 17 18 |
# File 'lib/skeleton_loader/configuration.rb', line 16 def templates @templates end |
Instance Method Details
#base_options ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/skeleton_loader/configuration.rb', line 32 def { scale: @scale, animation_type: @animation_type, additional_allowed_tags: @additional_allowed_tags, additional_allowed_attributes: @additional_allowed_attributes, additional_allowed_css_properties: @additional_allowed_css_properties } end |
#reset! ⇒ Object
Resets all configuration options to their defaults.
25 26 27 28 29 30 |
# File 'lib/skeleton_loader/configuration.rb', line 25 def reset! set_general_defaults set_template_defaults set_animation_defaults set_security_defaults end |
#template_defaults_for(type) ⇒ Object
Returns the default options for a specific template type
43 44 45 |
# File 'lib/skeleton_loader/configuration.rb', line 43 def template_defaults_for(type) @templates[type&.to_sym || :default] || @templates[:default] end |