Skip to content
Browse files

added examples of using the extended dot notation in hash keys to def…

…ine deeper variables
  • Loading branch information...
1 parent 9c4163b commit 0ab716b80e1a8d790a4fa3ee2062a1d95278367f @ejschmitt committed Sep 8, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 README
View
6 README
@@ -10,7 +10,7 @@ Requires Json (require 'json')
./script/plugin install git://github.com/ejschmitt/jsvars.git
-Example
+Examples
=======
in your controller:
@@ -21,6 +21,10 @@ jsvars[:myObject] = {:title => "My Page", :email => "me@example.com"}
- Adds the object variables that can be used as myObject.title & myObject.email in the view javascipt.
- This will add the object "myObject" if it does not exist, if it already does, only the variables will be added to the already existing object.
+jsvars['myObj.myMeth.myValue'] = "myVar"
+ - Adds the objects myObj, myMeth, myValue if they do not exist and defines the value of myObj.myMeth.myValue to myVar.
+ - Only undefined objects will be added, so if myObj exists but myMeth and myVal do not, they will be added to the myObj object.
+
Example of extending an object:
In controller:
jsvars[:login] = {:path => '/login'}

0 comments on commit 0ab716b

Please sign in to comment.
Something went wrong with that request. Please try again.