Permalink
Browse files

moved some html around so that the output looks better in the html

  • Loading branch information...
1 parent 0ab716b commit de96c2327ac2444cfa039c9ea563799c926e15a7 @ejschmitt committed Sep 8, 2009
Showing with 14 additions and 11 deletions.
  1. +14 −11 lib/jsvars.rb
View
@@ -24,20 +24,23 @@ def include_jsvars
possible_objects = variable.split('.')
possible_objects.each_with_index do |obj, i|
full_obj = possible_objects[0..i].join('.')
- object_tests <<
- "if(#{ full_obj } === undefined) {
- #{ "var" if i == 0 } #{ full_obj } = {};
- }
- "
+ object_tests <<
+"
+if(#{ full_obj } === undefined) {
+ #{ "var" if i == 0 } #{ full_obj } = {};
+}
+"
end
object_tests + "#{ variable } = #{ value.to_json };"
else
- "if (typeof(#{ variable }) === 'object') {
- jsvars.objExtend(#{ variable }, #{ value.to_json });
- }
- else {
- var #{ variable } = #{ value.to_json };
- }"
+"
+if (typeof(#{ variable }) === 'object') {
+ jsvars.objExtend(#{ variable }, #{ value.to_json });
+}
+else {
+ var #{ variable } = #{ value.to_json };
+}
+"
end
end

0 comments on commit de96c23

Please sign in to comment.