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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94d0c9ee41377b46876a345e273f048bde3be5b1
4
- data.tar.gz: d49028dba0fdc43f0e29571f0a9d10b2b609189d
3
+ metadata.gz: 7c1f683f3718051f6fd9f4933e5f286aa5956074
4
+ data.tar.gz: 3e4903506523c9f8ddec3e3035b55cd6c78ca819
5
5
  SHA512:
6
- metadata.gz: 5643aaa782229097bfbc9179b6089c9b460414f5b8c2c6ae2b2d8da967b427d8e09cb39d12094f72f371fe8b8d4c22257ba9374ee7066c24e348b5d8cf30df7d
7
- data.tar.gz: ad95e6cd2a9a338c4614c2c9de466d67c23d5ae2a9b6782cc50d6033b5fff836892c5bbc26265a947a5a862c997eb349496596fbad01e49eefed7ac1783a0f6d
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.js.erb
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.set('a.b.c.d', '123') # rails.values => {a: {b: {c: {d: '123'}}}}
57
- rails.get('a.b.c.d') # => '123'
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
  ```
@@ -21,5 +21,4 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.3"
23
23
  spec.add_development_dependency "rake"
24
- spec.add_dependency "rails"
25
24
  end
@@ -46,8 +46,11 @@ module Client
46
46
  end
47
47
 
48
48
  def self.generate
49
- data = YAML.load(ERB.new(File.new("#{Rails.root}/config/client_variable.yml").read).result)
50
- data[Rails.env]
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
@@ -1,3 +1,3 @@
1
1
  module ClientVariable
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  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.3
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-14 00:00:00.000000000 Z
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