client_variable 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/client_variable.gemspec +0 -1
- data/lib/client_variable.rb +5 -2
- data/lib/client_variable/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c1f683f3718051f6fd9f4933e5f286aa5956074
|
4
|
+
data.tar.gz: 3e4903506523c9f8ddec3e3035b55cd6c78ca819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e4cb10adc3372490d8c6fca1b1474c15385d2eb37733ba67478ff6af7523762770aed3a4fc0310d8c0509ad6658f4cc781925f4cf6b77cedb2ff651d5262dc
|
7
|
+
data.tar.gz: 4196d97c956b7fb2ac7ce83a108b55b6e61904eb52882cb24dd4eaa0fbb4e4359440278b8cadbac48d2cc0224f070e96ae6133ddf8b26053b4f2c07ce01e57eb
|
data/README.md
CHANGED
@@ -47,12 +47,15 @@ Inspired from gon - https://github.com/gazay/gon, you can also do these in your
|
|
47
47
|
|
48
48
|
Add this line on top of `app/assets/javascripts/application.js`
|
49
49
|
``` js
|
50
|
-
//= require variable
|
50
|
+
//= require variable
|
51
51
|
```
|
52
52
|
I also define global variable in javascript `rails`
|
53
53
|
Access the varaibles from your JavaScript file:
|
54
54
|
|
55
55
|
``` js
|
56
|
-
rails.
|
57
|
-
rails.get('
|
56
|
+
rails.get('variable_name') // => variable_value
|
57
|
+
rails.get('user_id') // => 1
|
58
|
+
|
59
|
+
rails.set('a.b.c.d', '123') // rails.values => {a: {b: {c: {d: '123'}}}}
|
60
|
+
rails.get('a.b.c.d') // => '123'
|
58
61
|
```
|
data/client_variable.gemspec
CHANGED
data/lib/client_variable.rb
CHANGED
@@ -46,8 +46,11 @@ module Client
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.generate
|
49
|
-
|
50
|
-
|
49
|
+
path = "#{Rails.root}/config/client_variable.yml"
|
50
|
+
config = if File.exist?(path)
|
51
|
+
data = YAML.load(ERB.new(File.new("#{Rails.root}/config/client_variable.yml").read).result)
|
52
|
+
data[Rails.env]
|
53
|
+
end || {}
|
51
54
|
end
|
52
55
|
|
53
56
|
class Engine < Rails::Engine; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client_variable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MQuy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: export variable in rails to client-side
|
56
42
|
email:
|
57
43
|
- sugiacupit@gmail.com
|