instance method
module_name_from
Ruby on Rails 2.0.3
Since v1.0.3 Last seen in v2.2.3 PrivateSignature
module_name_from(filename, mapping)
No documentation comment.
Parameters
-
filenamereq -
mappingreq
Source
# File lib/importmap/map.rb, line 143
def module_name_from(filename, mapping)
# Regex explanation:
# (?:\/|^) # Matches either / OR the start of the string
# index # Matches the word index
# $ # Matches the end of the string
#
# Sample matches
# index
# folder/index
index_regex = /(?:\/|^)index$/
[ mapping.under, filename.to_s.remove(filename.extname).remove(index_regex).presence ].compact.join("/")
end
Defined in lib/importmap/map.rb line 143
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Importmap::Map