Class: Isomorfeus::AssetManager::RubyImport
- Inherits:
-
Object
- Object
- Isomorfeus::AssetManager::RubyImport
- Defined in:
- lib/isomorfeus/asset_manager/ruby_import.rb
Instance Attribute Summary collapse
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
Instance Method Summary collapse
-
#initialize(ruby_module) ⇒ RubyImport
constructor
A new instance of RubyImport.
- #resolved_path ⇒ Object
- #to_dev_s(asset_name) ⇒ Object
- #to_s(asset_name) ⇒ Object
Constructor Details
#initialize(ruby_module) ⇒ RubyImport
Returns a new instance of RubyImport.
6 7 8 9 10 |
# File 'lib/isomorfeus/asset_manager/ruby_import.rb', line 6 def initialize(ruby_module) @ruby_module = ruby_module.end_with?('.rb') ? ruby_module : ruby_module + '.rb' @module_name = @ruby_module[0..-4] @import_name = @module_name.tr('/', '_') end |
Instance Attribute Details
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
4 5 6 |
# File 'lib/isomorfeus/asset_manager/ruby_import.rb', line 4 def module_name @module_name end |
Instance Method Details
#resolved_path ⇒ Object
12 13 14 |
# File 'lib/isomorfeus/asset_manager/ruby_import.rb', line 12 def resolved_path @resolved_path ||= resolve_path end |
#to_dev_s(asset_name) ⇒ Object
20 21 22 |
# File 'lib/isomorfeus/asset_manager/ruby_import.rb', line 20 def to_dev_s(asset_name) "await import(\"#{Isomorfeus.assets_path}/#{asset_name}/#{@module_name}.rb.js\");\n" end |
#to_s(asset_name) ⇒ Object
16 17 18 |
# File 'lib/isomorfeus/asset_manager/ruby_import.rb', line 16 def to_s(asset_name) "import(\"./#{asset_name}/#{@module_name}.rb.js\");\n" end |