Class: CKEditor5::Rails::Assets::AssetsBundle
- Inherits:
-
Object
- Object
- CKEditor5::Rails::Assets::AssetsBundle
show all
- Defined in:
- lib/ckeditor5/rails/assets/assets_bundle.rb
Instance Method Summary
collapse
Constructor Details
#initialize(scripts: nil, stylesheets: nil) ⇒ AssetsBundle
Returns a new instance of AssetsBundle.
8
9
10
11
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 8
def initialize(scripts: nil, stylesheets: nil)
@scripts = scripts
@stylesheets = stylesheets
end
|
Instance Method Details
#<<(other) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 40
def <<(other)
raise TypeError, 'other must be an instance of AssetsBundle' unless other.is_a?(AssetsBundle)
@scripts = scripts + other.scripts
@stylesheets = stylesheets + other.stylesheets
end
|
#empty? ⇒ Boolean
21
22
23
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 21
def empty?
scripts.empty? && stylesheets.empty?
end
|
#preloads ⇒ Object
29
30
31
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 29
def preloads
stylesheets + scripts.map(&:preloads)
end
|
#scripts ⇒ Object
13
14
15
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 13
def scripts
@scripts || []
end
|
#stylesheets ⇒ Object
17
18
19
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 17
def stylesheets
@stylesheets || []
end
|
#to_json(*_args) ⇒ Object
33
34
35
36
37
38
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 33
def to_json(*_args)
{
scripts: scripts.map(&:to_h),
stylesheets: stylesheets
}.to_json
end
|
#translations_scripts ⇒ Object
25
26
27
|
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 25
def translations_scripts
scripts.select(&:translation?)
end
|