Module: LexxyVariables::Placeholder

Defined in:
lib/lexxy_variables/placeholder.rb

Overview

The single definition of the placeholder token format. The pipeline writes tokens with #token and the renderers find them with #pattern, so the format only lives here.

Constant Summary collapse

PREFIX =
"@@lexxy-var-"

Class Method Summary collapse

Class Method Details

.pattern(nonce) ⇒ Object



12
13
14
# File 'lib/lexxy_variables/placeholder.rb', line 12

def self.pattern(nonce)
  /#{Regexp.escape(PREFIX)}#{Regexp.escape(nonce)}:([a-z][a-z0-9_.]*)@@/
end

.token(nonce, key) ⇒ Object



8
9
10
# File 'lib/lexxy_variables/placeholder.rb', line 8

def self.token(nonce, key)
  "#{PREFIX}#{nonce}:#{key}@@"
end