Class: CKEditor5::Rails::Cdn::CKBoxBundle

Inherits:
Assets::AssetsBundle show all
Includes:
UrlGenerator
Defined in:
lib/ckeditor5/rails/cdn/ckbox_bundle.rb

Constant Summary

Constants included from UrlGenerator

UrlGenerator::CDN_COMMERCIAL_GENERATORS, UrlGenerator::CDN_THIRD_PARTY_GENERATORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UrlGenerator

#create_cdn_url

Methods inherited from Assets::AssetsBundle

#<<, #empty?, #preloads, #translations_scripts

Constructor Details

#initialize(version, theme: :lark, cdn: Engine.default_preset.cdn, translations: []) ⇒ CKBoxBundle

Returns a new instance of CKBoxBundle.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 10

def initialize(version, theme: :lark, cdn: Engine.default_preset.cdn, translations: [])
  raise ArgumentError, 'version must be semver' unless version.is_a?(Semver)
  raise ArgumentError, 'theme must be a string' unless theme.is_a?(String)
  raise ArgumentError, 'translations must be an array' unless translations.is_a?(Array)

  super()

  @cdn = cdn
  @version = version
  @theme = theme
  @translations = translations
end

Instance Attribute Details

#cdnObject (readonly)

Returns the value of attribute cdn.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def cdn
  @cdn
end

#themeObject (readonly)

Returns the value of attribute theme.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def theme
  @theme
end

#translationsObject (readonly)

Returns the value of attribute translations.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def translations
  @translations
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def version
  @version
end

Instance Method Details

#scriptsObject



23
24
25
26
27
28
29
30
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 23

def scripts
  @scripts ||= [
    Assets::JSExportsMeta.new(
      create_cdn_url('ckbox', 'ckbox.js', version),
      *translations_js_exports_meta
    )
  ]
end

#stylesheetsObject



32
33
34
35
36
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 32

def stylesheets
  @stylesheets ||= [
    create_cdn_url('ckbox', "styles/themes/#{theme}.css", version)
  ]
end