lib/ruote/svc/dollar_sub.rb in ruote-2.3.0.1 vs lib/ruote/svc/dollar_sub.rb in ruote-2.3.0.2

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -89,22 +89,19 @@ # x field or the y variable. If the lookup is successful (not nil) will # return the value, not the text (the value.to_s). # def literal_sub(s, fexp, wi) - result = case s - when /^\$([^{}:])$/, /^\$(?:field|fld|f):([^{}]+)$/ - Ruote.lookup(wi['fields'], $~[1]) - when /^\$(?:variable|var|v):([^{}]+)$/ + case s + when /^\$(?:variable|var|v):([^{}\s\$]+)$/ fexp.lookup_variable($~[1]) + when /^\$([^{}:\s\$]+)$/, /^\$(?:field|fld|f):([^{}\s\$]+)$/ + Ruote.lookup(wi['fields'], $~[1]) else s end - - result.nil? ? s : result end end - # # A mini-namespace Ruote::Dollar for Dict and RubyContext, just to separate # them from the rest of Ruote. #