rjv 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWNkYzFkOWIzNWVhN2Y2YTkyNzU1YmE4MjY2ZWQ2MDk3NjRjZWQ4NQ==
5
+ data.tar.gz: !binary |-
6
+ ZWM4Y2E2MjIxNTQ5YzhkMjIyNTI0MDRmZTViYzYwOGU5NTM5ZjY3Yg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YzMyNDk3NjVhZTdiYzVjN2NmNWRkZmI5Zjc5ZThjZWRiOWVhMTQ4MWZmMDNi
10
+ NGI1OTA4OWFlZWU4NDY0ZWRjOGQ1N2QzOWQ3YzI4ODNkMzhkNjk4NjM5NzBi
11
+ ZjY0ZTM2M2YyZGFhMWQ4ZDU1NmM3MGU0Y2Y4NWU1MWIxOWI4ZmY=
12
+ data.tar.gz: !binary |-
13
+ ZGZjMWY3NWFmMjkwZjFmYWJlYmVkMDYxNWE0NmIzNGRlMGI3YmFmY2M1M2Y0
14
+ ODI5NGY2NGY2OTA5MTE0M2Y0NjhhZDVjNTNiM2NjYzY4MzBiNTA2NjM1NThi
15
+ MzNlNGUwNGRlNDM5MTYwMDI0ODZhYzFiNzkxYjY3N2QzMzU2OGM=
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /.rvmrc
2
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rjv (0.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ rjv!
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # rjv (Rails Javascript Variables)
2
+
3
+ rjv is a set of helpers that can inject any variables from rails to your javascript code.
4
+
5
+ ## Usage
6
+
7
+ Add this code at the bottom of your layout file (before closing body tag).
8
+
9
+ ```ruby
10
+ = javascript_tag do
11
+ !== vars = #{vars.to_json};
12
+ ```
13
+
14
+ Now you can inject variables in your views:
15
+
16
+ ```ruby
17
+ - set_var 'someVar', 'someValue'
18
+ ```
19
+
20
+ In javascript this variable will be available as:
21
+
22
+ ```javascript
23
+ console.log(vars.someVar)
24
+ ```
25
+
26
+ ## Copyright
27
+
28
+ Copyright (c) 2013 Michał Młoźniak.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ $:.unshift "#{File.dirname(__FILE__)}/lib"
2
+ require 'rjv'
data/lib/rjv.rb ADDED
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rjv/helpers'
4
+
5
+ module Rjv
6
+ end
7
+
8
+ if defined?(Rails)
9
+ ActionView::Base.send(:include, Rjv::Helpers)
10
+ ActionController::Base.send(:include, Rjv::Helpers)
11
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ module Rjv
4
+ module Helpers
5
+ def set_var(name, value)
6
+ vars[name.to_s] = value
7
+ end
8
+
9
+ def vars
10
+ @_rjv_vars ||= {}
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ module Rjv
4
+ VERSION = '0.1.0'
5
+ end
data/rjv.gemspec ADDED
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+
4
+ require 'date'
5
+ require 'rjv/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'rjv'
9
+ s.version = Rjv::VERSION
10
+ s.date = Date.today
11
+ s.summary = 'Pass your controller variables to javascript'
12
+ s.description = 'Pass your controller variables to javascript'
13
+ s.author = 'Michał Młoźniak'
14
+ s.email = 'michal.mlozniak@visuality.pl'
15
+ s.files = `git ls-files`.split("\n")
16
+
17
+ s.require_paths = ['lib']
18
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rjv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Michał Młoźniak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Pass your controller variables to javascript
14
+ email: michal.mlozniak@visuality.pl
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - .gitignore
20
+ - Gemfile
21
+ - Gemfile.lock
22
+ - README.md
23
+ - Rakefile
24
+ - init.rb
25
+ - lib/rjv.rb
26
+ - lib/rjv/helpers.rb
27
+ - lib/rjv/version.rb
28
+ - rjv.gemspec
29
+ homepage:
30
+ licenses: []
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 2.0.3
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Pass your controller variables to javascript
52
+ test_files: []
53
+ has_rdoc: