Module: Crosstest::Psychic::Tokens

Defined in:
lib/crosstest/psychic.rb,
lib/crosstest/psychic/tokens.rb

Defined Under Namespace

Classes: MustacheTokenHandler, RegexpTokenHandler

Class Method Summary collapse

Class Method Details

.replace_tokens(template, variables, token_regexp = nil, token_replacement = nil) ⇒ Object


42
43
44
45
46
47
48
# File 'lib/crosstest/psychic/tokens.rb', line 42

def self.replace_tokens(template, variables, token_regexp = nil, token_replacement = nil)
  if token_regexp.nil?
    MustacheTokenHandler.new(template).render(variables)
  else
    RegexpTokenHandler.new(template, token_regexp, token_replacement).render(variables)
  end
end