instance method module_name_from

Ruby on Rails 2.0.3

Since v1.0.3 Last seen in v2.2.3 Private

Available in: v1.0.3 v1.1.6 v1.2.3 v2.0.3 v2.1.0 v2.2.3

Signature

module_name_from(filename, mapping)

No documentation comment.

Parameters

filename req
mapping req
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close