Module: Kwartz::RubyExpressionParser
- Included in:
- ErubisTranslator, ErubyTranslator, PIErubisTranslator, RailsTranslator, RubyHandler, RubyTranslator
- Defined in:
- lib/kwartz/binding/ruby.rb
Instance Method Summary collapse
Instance Method Details
#parse_expr_str(expr_str, linenum) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kwartz/binding/ruby.rb', line 18 def parse_expr_str(expr_str, linenum) case expr_str when /\A(\w+)\z/ # variable expr = expr_str when /\A(\w+)\.(\w+)\z/ # object.property expr = expr_str when /\A(\w+)\[('.*?'|".*?"|:\w+)\]\z/ # hash expr = expr_str when /\A(\w+)\[(\w+)\]\z/ # array or hash expr = expr_str else raise convert_error("'#{expr_str}': invalid expression.", linenum) end return expr end |
#parse_expr_str!(expr_str) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/kwartz/binding/ruby.rb', line 35 def parse_expr_str!(expr_str) begin return parse_expr_str!(expr_str, -1) rescue return expr_str end end |