Class: Ckeditor::Rails::Asset
- Inherits:
-
Object
- Object
- Ckeditor::Rails::Asset
- Defined in:
- lib/ckeditor-rails/asset.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #files ⇒ Object
- #image_files ⇒ Object
-
#initialize(name = 'ckeditor', path = '../vendor/assets') ⇒ Asset
constructor
A new instance of Asset.
- #javascript_files ⇒ Object
- #stylesheet_files ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/ckeditor-rails/asset.rb', line 5 def name @name end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
5 6 7 |
# File 'lib/ckeditor-rails/asset.rb', line 5 def root @root end |
Instance Method Details
#files ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/ckeditor-rails/asset.rb', line 47 def files files = [] files += image_files files += javascript_files files += stylesheet_files files end |
#image_files ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ckeditor-rails/asset.rb', line 12 def image_files path = root.join('images', name) files = Dir.glob(path.join('plugins', '**', '*.{png,gif,jpg}')).reject { |file| invalid_plugin_file?(file) } files += Dir.glob(path.join('skins', '**', '*.{png,gif,jpg}')).reject { |file| invalid_skin_file?(file) } files end |
#javascript_files ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ckeditor-rails/asset.rb', line 23 def javascript_files path = root.join('javascripts', name) files = Dir.glob(path.join('*.js')) files += Dir.glob(path.join('lang', '*.js')).reject { |file| invalid_lang_file?(file) } files += Dir.glob(path.join('plugins', '**', '*.{js,html}')).reject { |file| invalid_plugin_file?(file) or invalid_lang_file?(file) } files end |
#stylesheet_files ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ckeditor-rails/asset.rb', line 35 def stylesheet_files path = root.join('stylesheets', name) files = Dir.glob(path.join('*.css')) files += Dir.glob(path.join('plugins', '**', '*.css')).reject { |file| invalid_plugin_file?(file) } files += Dir.glob(path.join('skins', '**', '*.css')).reject { |file| invalid_skin_file?(file) } files end |