class TracLang::Expression
Model of TRAC neutral string expression. An expression is an array of strings, corresponding to the arguments of a TRAC expression. Expressions are active if they were called by #(…) and not active (neutral) if they were called by ##(…).
Attributes
Flag to tell if this expression is active or neutral. The result of active expressions are copied to the active string, while the result of neutral expressions are copied to the enclosing expression.
Flag to tell if this expression is active or neutral. The result of active expressions are copied to the active string, while the result of neutral expressions are copied to the enclosing expression.
List of arguments for this expression.
Public Class Methods
Creates new active expression.
# File lib/trac_lang/expression.rb, line 21 def initialize @args = [''] @active = true end
Public Instance Methods
Command for TRAC processor.
# File lib/trac_lang/expression.rb, line 27 def command @args[0].downcase.to_sym end
Adds a string to current argument of the expression.
# File lib/trac_lang/expression.rb, line 37 def concat(str) @args.last.concat str end
Signals a new argument is starting.
# File lib/trac_lang/expression.rb, line 42 def newarg @args.push '' end
Returns current number of arguments in expression.
# File lib/trac_lang/expression.rb, line 47 def size @args.size end
String version of expression, used when trace is on
# File lib/trac_lang/expression.rb, line 52 def to_s (@active ? '#/' : '##/') + @args.join('*') + '/' end
Arguments for TRAC command.
# File lib/trac_lang/expression.rb, line 32 def trac_args @args[1..-1] end