Class: LtdTemplate::Proxy::Match
- Inherits:
-
LtdTemplate::Proxy
- Object
- LtdTemplate::Proxy
- LtdTemplate::Proxy::Match
- Defined in:
- lib/ltdtemplate/proxy/match.rb
Instance Attribute Summary
Attributes included from Value
Instance Method Summary collapse
-
#[](*args) ⇒ Object
Access array-like results.
- #do_offset(opts) ⇒ Object
-
#evaluate(opts = {}) ⇒ Object
Evaluate supported methods for regexp matches.
-
#tpl_text ⇒ Object
Renders as empty string in a template.
Methods inherited from LtdTemplate::Proxy
#initialize, #rubyverse_original, #rubyversed
Methods included from Value
#do_methods, #do_run_method, included, #initialize, #inspect, #rubyversed, #tpl_boolean
Constructor Details
This class inherits a constructor from LtdTemplate::Proxy
Instance Method Details
#[](*args) ⇒ Object
Access array-like results
12 |
# File 'lib/ltdtemplate/proxy/match.rb', line 12 def [] (*args); @original[*args]; end |
#do_offset(opts) ⇒ Object
30 31 32 33 34 35 36 |
# 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 = {}) ⇒ Object
Evaluate supported methods for regexp matches.
15 16 17 18 19 20 21 22 23 |
# 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 ⇒ Object
Renders as empty string in a template.
26 |
# File 'lib/ltdtemplate/proxy/match.rb', line 26 def tpl_text; ''; end |