Class: JsDependency::ReplacePathAlias
- Inherits:
-
Object
- Object
- JsDependency::ReplacePathAlias
- Defined in:
- lib/js_dependency/replace_path_alias.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ String
-
#initialize(str, alias_paths = nil) ⇒ ReplacePathAlias
constructor
A new instance of ReplacePathAlias.
Constructor Details
#initialize(str, alias_paths = nil) ⇒ ReplacePathAlias
Returns a new instance of ReplacePathAlias.
7 8 9 10 |
# File 'lib/js_dependency/replace_path_alias.rb', line 7 def initialize(str, alias_paths = nil) @str = str @alias_paths = alias_paths end |
Class Method Details
.call(str, alias_paths = nil) ⇒ String
15 16 17 18 19 |
# File 'lib/js_dependency/replace_path_alias.rb', line 15 def self.call(str, alias_paths = nil) return str if alias_paths.nil? || alias_paths.empty? new(str, alias_paths).call end |
Instance Method Details
#call ⇒ String
22 23 24 25 26 |
# File 'lib/js_dependency/replace_path_alias.rb', line 22 def call return @str if safe_list.include?(@str) replace_alias_paths(@str, @alias_paths) end |