class LtdTemplate::Proxy::Match

Public Instance Methods

[](*args) click to toggle source

Access array-like results

# File lib/ltdtemplate/proxy/match.rb, line 12
def [] (*args); @original[*args]; end
do_offset(opts) click to toggle source
# File lib/ltdtemplate/proxy/match.rb, line 30
def do_offset (opts)
    if (params = opts[:parameters]) && params.size(:seq) > 0 &&
      params[0].is_a?(::Numeric)
        @original.send opts[:method].to_sym, params[0]
    else nil
    end
end
evaluate(opts = {}) click to toggle source

Evaluate supported methods for regexp matches.

# File lib/ltdtemplate/proxy/match.rb, line 15
def evaluate (opts = {})
    case opts[:method]
    when nil, 'call' then @original
    when 'begin', 'end', 'offset' then do_offset opts
    when 'class' then 'Match'
    when 'length', 'size' then @original.size
    when 'type' then 'match'
    end
end
tpl_text() click to toggle source

Renders as empty string in a template.

# File lib/ltdtemplate/proxy/match.rb, line 26
def tpl_text; ''; end