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.



53
54
55
56
57
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 53

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.



49
50
51
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 49

def import_meta
  @import_meta
end

#urlObject (readonly)

Returns the value of attribute url.



49
50
51
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 49

def url
  @url
end

Instance Method Details

#preloadsObject



70
71
72
73
74
75
76
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 70

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

#to_hObject



63
64
65
66
67
68
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 63

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

#translation?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 59

def translation?
  @translation
end