class Coppertone::MacroString::MacroStaticExpand
A internal class that represents one of a few special terms in the macro string definition. These terms include a '%', but do not depend on the SPF request context.
Constants
- PERCENT_MACRO
Replaces '%%' in a macro string
- SIMPLE_INTERPOLATED_MACRO_LETTERS
- SPACE_MACRO
Replaces '%_' in a macro string
- URL_ENCODED_SPACE_MACRO
Replaces '%-' in a macro string
Public Class Methods
exists_for?(x)
click to toggle source
# File lib/coppertone/macro_string/macro_static_expand.rb, line 32 def self.exists_for?(x) return false unless x && (x.length == 2) && (x[0] == '%') SIMPLE_INTERPOLATED_MACRO_LETTERS.include?(x[1]) end
macro_for(x)
click to toggle source
# File lib/coppertone/macro_string/macro_static_expand.rb, line 38 def self.macro_for(x) raise Coppertone::MacroStringParsingError unless exists_for?(x) case x[1] when '%' PERCENT_MACRO when '_' SPACE_MACRO when '-' URL_ENCODED_SPACE_MACRO end end
Private Class Methods
new(macro_text, s)
click to toggle source
# File lib/coppertone/macro_string/macro_static_expand.rb, line 9 def initialize(macro_text, s) @macro_text = macro_text @str = s end
Public Instance Methods
expand(_context, _request = nil)
click to toggle source
# File lib/coppertone/macro_string/macro_static_expand.rb, line 14 def expand(_context, _request = nil) @str end
to_s()
click to toggle source
# File lib/coppertone/macro_string/macro_static_expand.rb, line 18 def to_s @macro_text end