js_vars 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/js_vars.gemspec +1 -1
- data/lib/js_vars.rb +9 -2
- data/lib/js_vars/rails/railtie.rb +1 -0
- data/lib/js_vars/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbc7a3fec4d8399108ab2117b954f1fc6dbf960b
|
4
|
+
data.tar.gz: d3d254c47d654105fbf8b96d509727aaba520a11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1335fa0fb2065f71f6cf208c24509a8353e60c7eb45f3c3c270a033cfe6e84b124ca7eab5c5b95aa613e4e2b40e5af323d0bb75b99a0860c0cd199d622235469
|
7
|
+
data.tar.gz: 0178c59e92e71bc7bfaae2761700206a57f6b52a54167ecb076a618326a4ec9d6ea07b96fef7e645f8af136c69428a3416fb7d0fb936224f833707ecdb03c5d5
|
data/README.md
CHANGED
@@ -55,6 +55,19 @@ To solve this problems I have written gem `jsvars`.
|
|
55
55
|
namespace: To change particular variable namespace
|
56
56
|
json: To change rendering object fields.
|
57
57
|
|
58
|
+
### Configuration - It is optional
|
59
|
+
|
60
|
+
To change default namespace add following code to your config initializers
|
61
|
+
|
62
|
+
i.e in `config/initializers/js_vars.rb`
|
63
|
+
|
64
|
+
JsVars.configure do |c|
|
65
|
+
c.namespace = 'MyNamespace'
|
66
|
+
end
|
67
|
+
|
68
|
+
So now by default all variables renders in `MyNamespace` namespace
|
69
|
+
|
70
|
+
|
58
71
|
## Installation
|
59
72
|
|
60
73
|
Add this line to your application's Gemfile:
|
data/js_vars.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["jirenpatel@gmail.com"]
|
11
11
|
spec.description = %q{Manage javascript variables in html templates}
|
12
12
|
spec.summary = %q{Manage javascript variables in html templates}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/jiren/js_vars"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
data/lib/js_vars.rb
CHANGED
@@ -9,8 +9,15 @@ module JsVars
|
|
9
9
|
|
10
10
|
class << self
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
attr_accessor :namespace
|
13
|
+
|
14
|
+
def configure(&block)
|
15
|
+
self.namespace = 'APP'
|
16
|
+
yield(self) if block_given?
|
17
|
+
end
|
18
|
+
|
19
|
+
def add(vars, namespace = nil)
|
20
|
+
VarMap.add(vars, namespace || self.namespace) if vars.is_a?(Hash)
|
14
21
|
end
|
15
22
|
|
16
23
|
def clear
|
data/lib/js_vars/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_vars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jiren Patel
|
@@ -60,7 +60,7 @@ files:
|
|
60
60
|
- lib/js_vars/var_map.rb
|
61
61
|
- lib/js_vars/version.rb
|
62
62
|
- vendor/assets/javascripts/js_vars.js
|
63
|
-
homepage:
|
63
|
+
homepage: https://github.com/jiren/js_vars
|
64
64
|
licenses:
|
65
65
|
- MIT
|
66
66
|
metadata: {}
|