Class: CKEditor5::Rails::Assets::JSImportMeta

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(import_as: nil, import_name: nil, window_name: nil) ⇒ JSImportMeta

Returns a new instance of JSImportMeta.



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

def initialize(import_as: nil, import_name: nil, window_name: nil)
  validate_arguments!(import_as, import_name, window_name)
  @import_as = import_as
  @import_name = import_name
  @window_name = window_name
end

Instance Attribute Details

#import_asObject (readonly)

Returns the value of attribute import_as.



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

def import_as
  @import_as
end

#import_nameObject (readonly)

Returns the value of attribute import_name.



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

def import_name
  @import_name
end

#window_nameObject (readonly)

Returns the value of attribute window_name.



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

def window_name
  @window_name
end

Instance Method Details

#esm?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 67

def esm?
  import_name.present?
end

#to_hObject



75
76
77
78
79
80
81
# File 'lib/ckeditor5/rails/assets/assets_bundle.rb', line 75

def to_h
  {
    import_as: import_as,
    import_name: import_name,
    window_name: window_name
  }.compact
end

#window?Boolean

Returns:

  • (Boolean)


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

def window?
  window_name.present?
end