Class: CKEditor5::Rails::Assets::JSUrlImportMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/ckeditor5/rails/assets/assets_bundle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, translation: false, **import_options) ⇒ JSUrlImportMeta

Returns a new instance of JSUrlImportMeta.



46
47
48
49
50
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 46

def initialize(url, translation: false, **import_options)
  @url = url
  @import_meta = JSImportMeta.new(**import_options)
  @translation = translation
end

Instance Attribute Details

#import_metaObject (readonly)

Returns the value of attribute import_meta.



42
43
44
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 42

def import_meta
  @import_meta
end

#urlObject (readonly)

Returns the value of attribute url.



42
43
44
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 42

def url
  @url
end

Instance Method Details

#preloadsObject



60
61
62
63
64
65
66
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 60

def preloads
  {
    as: 'script',
    rel: esm? ? 'modulepreload' : 'preload',
    href: url
  }
end

#to_hObject



56
57
58
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 56

def to_h
  import_meta.to_h.merge({ url: url })
end

#translation?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 52

def translation?
  @translation
end