Permalink
Browse files

added some documentation

  • Loading branch information...
1 parent f183a11 commit 7a6d7470a6361132dbd15314d97d682d97e1cfd2 @ejschmitt committed Sep 7, 2009
View
@@ -1,11 +0,0 @@
-K 25
-svn:wc:ra_dav:version-url
-V 90
-/!svn/ver/3551/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/lib
-END
-jsvars.rb
-K 25
-svn:wc:ra_dav:version-url
-V 100
-/!svn/ver/3551/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/lib/jsvars.rb
-END
View
@@ -1,69 +0,0 @@
-9
-
-dir
-3574
-http://svn.eng.vitrue.com/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/lib
-http://svn.eng.vitrue.com
-
-
-
-2009-09-03T16:04:46.434318Z
-3551
-erick
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-ed038e9a-8caf-e94d-a586-6c6eaae76fb0
-
-
-
-
-
-
-0
-
-jsvars.rb
-file
-
-
-
-
-2009-09-02T21:54:08.000000Z
-b15d49fd6346804cc3a405f0a143e4da
-2009-09-03T16:04:46.434318Z
-3551
-erick
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2090
-
View
@@ -1 +0,0 @@
-9
@@ -1,5 +0,0 @@
-K 13
-svn:eol-style
-V 6
-native
-END
@@ -1,62 +0,0 @@
-require 'json'
-
-module Jsvars
- def self.included(base)
- base.send(:include, InstanceMethods)
- end
-
- module InstanceMethods
- def jsvars
- @jsvars = @jsvars || Hash.new
- end
-
- def include_jsvars
- jsvars = @jsvars
- name = 'jsvars'
- return unless jsvars
- close_tag_index = response.body.index /<\/body>/i
- js_assignments = []
- jsvars.each do |variable, value|
- js_assignments <<
- "
- if (typeof(#{ variable }) === 'object') {
- jsvars.objectExtend(#{ variable }, #{ value.to_json });
- }
- else {
- var #{ variable } = #{ value.to_json };
- }
- "
- end
-
- added_HTML =
- # this really should be in its own .js file... but its so simple it almost seems pointless
- "
- <!-- added by the #{ name } plugin -->
- <script>
- var jsvars;
- (function () {
- jsvars = {
- objectExtend: function (mainObject) {
- var i;
- for (i = 1; i < arguments.length; i += 1) {
- for (prop in arguments[i]){
- if (arguments[i].hasOwnProperty(prop)) {
- mainObject[prop] = arguments[i][prop];
- }
- }
- }
- return mainObject;
- } //end func
- }
- }());
-
- #{ js_assignments.join }
-
- </script>
- <!-- end #{ name } plugin code -->
- ".gsub(/\t/, " ").squeeze(' ')
-
- response.body.insert close_tag_index, added_HTML if close_tag_index
- end
- end
-end
@@ -1,11 +0,0 @@
-K 25
-svn:wc:ra_dav:version-url
-V 92
-/!svn/ver/3469/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/tasks
-END
-jsvars_tasks.rake
-K 25
-svn:wc:ra_dav:version-url
-V 110
-/!svn/ver/3469/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/tasks/jsvars_tasks.rake
-END
View
@@ -1,69 +0,0 @@
-9
-
-dir
-3574
-http://svn.eng.vitrue.com/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/tasks
-http://svn.eng.vitrue.com
-
-
-
-2009-08-31T21:14:57.880456Z
-3469
-erick
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-ed038e9a-8caf-e94d-a586-6c6eaae76fb0
-
-
-
-
-
-
-0
-
-jsvars_tasks.rake
-file
-
-
-
-
-2009-08-31T19:14:03.000000Z
-dd1072ac6bd44739fb121b1ae3cd2bad
-2009-08-31T21:14:57.880456Z
-3469
-erick
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-84
-
View
@@ -1 +0,0 @@
-9
@@ -1,5 +0,0 @@
-K 13
-svn:eol-style
-V 6
-native
-END
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :jsvars do
-# # Task goes here
-# end
View
@@ -1,17 +0,0 @@
-K 25
-svn:wc:ra_dav:version-url
-V 91
-/!svn/ver/3469/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/test
-END
-jsvars_test.rb
-K 25
-svn:wc:ra_dav:version-url
-V 106
-/!svn/ver/3469/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/test/jsvars_test.rb
-END
-test_helper.rb
-K 25
-svn:wc:ra_dav:version-url
-V 106
-/!svn/ver/3469/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/test/test_helper.rb
-END
View
@@ -1,103 +0,0 @@
-9
-
-dir
-3574
-http://svn.eng.vitrue.com/repo/projects/product/brandconnect/trunk/railsapp/vendor/plugins/jsvars/test
-http://svn.eng.vitrue.com
-
-
-
-2009-08-31T21:14:57.880456Z
-3469
-erick
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-ed038e9a-8caf-e94d-a586-6c6eaae76fb0
-
-
-
-
-
-
-0
-
-jsvars_test.rb
-file
-
-
-
-
-2009-08-31T19:14:03.000000Z
-2ea4def785db2132c625a5453bb40d96
-2009-08-31T21:14:57.880456Z
-3469
-erick
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-153
-
-test_helper.rb
-file
-
-
-
-
-2009-08-31T19:14:03.000000Z
-0f57f5fd3650bdad64fa70be9fd4f761
-2009-08-31T21:14:57.880456Z
-3469
-erick
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-78
-
View
@@ -1 +0,0 @@
-9
@@ -1,5 +0,0 @@
-K 13
-svn:eol-style
-V 6
-native
-END
@@ -1,5 +0,0 @@
-K 13
-svn:eol-style
-V 6
-native
-END
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class JsvarsTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
@@ -1,3 +0,0 @@
-require 'rubygems'
-require 'active_support'
-require 'active_support/test_case'

0 comments on commit 7a6d747

Please sign in to comment.