Skip to content

Commit 22e1210

Browse files
committed
Bump version after pull request commits
1 parent 8516472 commit 22e1210

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ For Sinatra available [gon-sinatra](https://github.com/gazay/gon-sinatra).
1111

1212
## An example of typical use
1313

14+
### Very good and detailed example and reasons to use is considered in [railscast](http://railscasts.com/episodes/324-passing-data-to-javascript) by Ryan Bates
15+
1416
When you need to send some start data from your controller to your js
1517
you might be doing something like this:
1618

lib/gon.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
module Gon
1515
class << self
16+
1617
def all_variables
1718
@request_env[:gon]
1819
end
@@ -63,10 +64,12 @@ def set_variable(name, value)
6364
@request_env[:gon][name] = value
6465
end
6566

67+
# TODO: Remove required argument view_path, and by default use current action
6668
def rabl(view_path, options = {})
6769
if !defined?(Gon::Rabl)
6870
raise NoMethodError.new('You should define Rabl in your Gemfile')
6971
end
72+
7073
rabl_data = Gon::Rabl.parse_rabl(view_path, options[:controller] ||
7174
@request_env['action_controller.instance'] ||
7275
@request_env['action_controller.rescue.response'].
@@ -106,4 +109,5 @@ def jbuilder(view_path, options = {})
106109
end
107110
end
108111
end
112+
109113
end

lib/gon/helpers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Gon
22
module Helpers
3+
34
def self.included base
45
base.send(:include, InstanceMethods)
56
end
@@ -43,6 +44,7 @@ def gon
4344
end
4445
end
4546
end
47+
4648
end
4749

4850
ActionView::Base.send :include, Gon::Helpers

lib/gon/jbuilder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def find_partials(lines = [])
4141
end
4242
end.flatten
4343
end
44+
4445
end
4546
end
4647
end

lib/gon/rabl.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
module Gon
44
module Rabl
55
class << self
6+
67
def parse_rabl(rabl_path, controller)
78
source = File.read(rabl_path)
89
rabl_engine = ::Rabl::Engine.new(source, :format => 'json')
910
output = rabl_engine.render(controller, {})
1011
JSON.parse(output)
1112
end
13+
1214
end
1315
end
1416
end

lib/gon/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Gon
2-
VERSION = '2.0.6'
2+
VERSION = '2.1.0'
33
end

0 commit comments

Comments
 (0)