Class: Vuesfc2js::Conversion::ReplacePathAlias

Inherits:
Object
  • Object
show all
Defined in:
lib/vuesfc2js/conversion/replace_path_alias.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, path_alias = nil) ⇒ ReplacePathAlias

Returns a new instance of ReplacePathAlias.

Parameters:

  • str (String)
  • path_alias (Hash, nil) (defaults to: nil)


8
9
10
11
# File 'lib/vuesfc2js/conversion/replace_path_alias.rb', line 8

def initialize(str, path_alias = nil)
  @str = str
  @path_alias = path_alias
end

Class Method Details

.call(str, path_alias = nil) ⇒ String

Parameters:

  • str (String)
  • path_alias (Hash, nil) (defaults to: nil)

Returns:

  • (String)


16
17
18
19
20
# File 'lib/vuesfc2js/conversion/replace_path_alias.rb', line 16

def self.call(str, path_alias = nil)
  return str if path_alias.nil? || path_alias.empty?

  new(str, path_alias).call
end

Instance Method Details

#callString

Returns:

  • (String)


23
24
25
# File 'lib/vuesfc2js/conversion/replace_path_alias.rb', line 23

def call
  replace_path_alias(@str, @path_alias)
end