Skip to content

Commit

Permalink
Only use negative look-ahead regexp with ruby 1.9. It's not available…
Browse files Browse the repository at this point in the history
… in 1.8.
  • Loading branch information
lance committed Aug 3, 2012
1 parent f5ec29c commit 5539935
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/awestruct/handlers/interpolation_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ def rendered_content(context, with_layouts=true)

content = content.gsub( /\\/, '\\\\\\\\' )
content = content.gsub( /\\\\#/, '\\#' )
content = content.gsub( /#(?!{)/, '\#' )
content = content.gsub( /#(?!{)/, '\#' ) if is_ruby_19?
content = content.gsub( '@', '\@' )
content = "%@#{content}@"
c = context.instance_eval( content )
c

end

def is_ruby_19?
@is_ruby_19 ||= (::Config::CONFIG['ruby_version'] =~ %r(^1\.9))
end

end
end
end

0 comments on commit 5539935

Please sign in to comment.