lib/importmap/map.rb in importmap-rails-0.3.0 vs lib/importmap/map.rb in importmap-rails-0.3.1
- old
+ new
@@ -74,19 +74,10 @@
end
end
end
def module_name_from(filename, mapping)
- filename_without_ext_and_version = filename.to_s.remove(filename.extname).split("@").first
-
- case
- when filename_without_ext_and_version == "index" && mapping.under
- mapping.under
- when mapping.under
- "#{mapping.under}/#{filename_without_ext_and_version}"
- else
- module_name
- end
+ [ mapping.under, filename.to_s.remove(filename.extname).remove(/\/?index$/).presence ].compact.join("/")
end
def module_path_from(filename, mapping)
[ mapping.path || mapping.under, filename.to_s ].join("/")
end