gon 2.1.2 → 2.2.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.
Potentially problematic release.
This version of gon might be problematic. Click here for more details.
- data/README.md +26 -11
 - data/Rakefile +6 -1
 - data/gon.gemspec +1 -0
 - data/lib/gon.rb +52 -42
 - data/lib/gon/version.rb +1 -1
 - data/spec/gon/gon_spec.rb +143 -50
 - metadata +108 -60
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -149,31 +149,45 @@ Profit of using Rabl with gon: 
     | 
|
| 
       149 
149 
     | 
    
         
             
              5. And so on
         
     | 
| 
       150 
150 
     | 
    
         | 
| 
       151 
151 
     | 
    
         
             
            For using gon with Rabl you need to create new Rabl template and map gon
         
     | 
| 
       152 
     | 
    
         
            -
            to it. 
     | 
| 
      
 152 
     | 
    
         
            +
            to it.
         
     | 
| 
       153 
153 
     | 
    
         
             
            For example you have model Post with attributes :title and :body.
         
     | 
| 
       154 
154 
     | 
    
         
             
            You want to get all your posts in your js as an Array.
         
     | 
| 
       155 
155 
     | 
    
         
             
            That's what you need to do:
         
     | 
| 
       156 
156 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
              1. Create Rabl template.  
     | 
| 
       158 
     | 
    
         
            -
                  
     | 
| 
      
 157 
     | 
    
         
            +
              1. Create Rabl template. You can choose spepicific directory but better
         
     | 
| 
      
 158 
     | 
    
         
            +
                 use default directory for action.
         
     | 
| 
       159 
159 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
                `app/ 
     | 
| 
      
 160 
     | 
    
         
            +
                `app/views/posts/index.json.rabl`
         
     | 
| 
       161 
161 
     | 
    
         | 
| 
       162 
162 
     | 
    
         
             
                ``` rabl
         
     | 
| 
       163 
163 
     | 
    
         
             
                collection @posts => 'posts'
         
     | 
| 
       164 
164 
     | 
    
         
             
                attributes :id, :title, :body
         
     | 
| 
       165 
165 
     | 
    
         
             
                ```
         
     | 
| 
       166 
166 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
              2.  
     | 
| 
      
 167 
     | 
    
         
            +
              2. If you create template in default directory for action, you just write in this action:
         
     | 
| 
       168 
168 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
                `app/controllers/ 
     | 
| 
      
 169 
     | 
    
         
            +
                `app/controllers/posts_controller.rb#index`
         
     | 
| 
       170 
170 
     | 
    
         | 
| 
       171 
171 
     | 
    
         
             
                ``` ruby
         
     | 
| 
       172 
172 
     | 
    
         
             
                def index
         
     | 
| 
       173 
173 
     | 
    
         
             
                  # some controller logic
         
     | 
| 
       174 
174 
     | 
    
         
             
                  @posts = Post.all # Rabl works with instance variables of controller
         
     | 
| 
       175 
175 
     | 
    
         | 
| 
       176 
     | 
    
         
            -
                  gon.rabl 
     | 
| 
      
 176 
     | 
    
         
            +
                  gon.rabl
         
     | 
| 
      
 177 
     | 
    
         
            +
                  # some controller logic
         
     | 
| 
      
 178 
     | 
    
         
            +
                end
         
     | 
| 
      
 179 
     | 
    
         
            +
                ```
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                 But if you choose some specific category - you need to map this template to gon.
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
                `app/controllers/posts_controller.rb#index`
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                ``` ruby
         
     | 
| 
      
 186 
     | 
    
         
            +
                def index
         
     | 
| 
      
 187 
     | 
    
         
            +
                  # some controller logic
         
     | 
| 
      
 188 
     | 
    
         
            +
                  @posts = Post.all # Rabl works with instance variables of controller
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
                  gon.rabl :template => 'app/goners/posts/index.rabl'
         
     | 
| 
       177 
191 
     | 
    
         
             
                  # some controller logic
         
     | 
| 
       178 
192 
     | 
    
         
             
                end
         
     | 
| 
       179 
193 
     | 
    
         
             
                ```
         
     | 
| 
         @@ -217,7 +231,7 @@ gon mapping method: 
     | 
|
| 
       217 
231 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       218 
232 
     | 
    
         
             
            # your controller stuff here
         
     | 
| 
       219 
233 
     | 
    
         | 
| 
       220 
     | 
    
         
            -
            gon.rabl  
     | 
| 
      
 234 
     | 
    
         
            +
            gon.rabl :as => 'alias'
         
     | 
| 
       221 
235 
     | 
    
         
             
            ```
         
     | 
| 
       222 
236 
     | 
    
         | 
| 
       223 
237 
     | 
    
         
             
            ## Usage with Jbuilder
         
     | 
| 
         @@ -243,7 +257,8 @@ Jbuilder works now only on Ruby 1.9+, so Gon support for Jbuilder works on 1.9+ 
     | 
|
| 
       243 
257 
     | 
    
         
             
                json.posts @posts, :id, :title, :body
         
     | 
| 
       244 
258 
     | 
    
         
             
                ```
         
     | 
| 
       245 
259 
     | 
    
         | 
| 
       246 
     | 
    
         
            -
              2. In your controller you should  
     | 
| 
      
 260 
     | 
    
         
            +
              2. In your controller you should just call 'gon.jbuilder' - if your template in
         
     | 
| 
      
 261 
     | 
    
         
            +
                 default directory for action. In the other case - you still can use :template option.
         
     | 
| 
       247 
262 
     | 
    
         | 
| 
       248 
263 
     | 
    
         
             
                ``` ruby
         
     | 
| 
       249 
264 
     | 
    
         
             
                def index
         
     | 
| 
         @@ -287,13 +302,13 @@ wouldn't work. You can read about this in common usage above. 
     | 
|
| 
       287 
302 
     | 
    
         
             
            Puts this line into `Gemfile` then run `$ bundle`:
         
     | 
| 
       288 
303 
     | 
    
         | 
| 
       289 
304 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       290 
     | 
    
         
            -
            gem 'gon', '2. 
     | 
| 
      
 305 
     | 
    
         
            +
            gem 'gon', '2.2.0'
         
     | 
| 
       291 
306 
     | 
    
         
             
            ```
         
     | 
| 
       292 
307 
     | 
    
         | 
| 
       293 
308 
     | 
    
         
             
            Or if you are old-school Rails 2 developer put this into `config/environment.rb` and run `$ rake gems:install`:
         
     | 
| 
       294 
309 
     | 
    
         | 
| 
       295 
310 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       296 
     | 
    
         
            -
            config.gem 'gon', :version => '2. 
     | 
| 
      
 311 
     | 
    
         
            +
            config.gem 'gon', :version => '2.2.0'
         
     | 
| 
       297 
312 
     | 
    
         
             
            ```
         
     | 
| 
       298 
313 
     | 
    
         | 
| 
       299 
314 
     | 
    
         
             
            Or manually install gon gem: `$ gem install gon`
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/gon.gemspec
    CHANGED
    
    
    
        data/lib/gon.rb
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            if RUBY_VERSION  
     | 
| 
      
 1 
     | 
    
         
            +
            if RUBY_VERSION > '1.9' && defined?(Jbuilder)
         
     | 
| 
       2 
2 
     | 
    
         
             
              gem 'blankslate'
         
     | 
| 
       3 
3 
     | 
    
         
             
            end
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'action_view'
         
     | 
| 
         @@ -8,7 +8,7 @@ require 'gon/escaper' 
     | 
|
| 
       8 
8 
     | 
    
         
             
            if defined?(Rabl)
         
     | 
| 
       9 
9 
     | 
    
         
             
              require 'gon/rabl'
         
     | 
| 
       10 
10 
     | 
    
         
             
            end
         
     | 
| 
       11 
     | 
    
         
            -
            if RUBY_VERSION  
     | 
| 
      
 11 
     | 
    
         
            +
            if RUBY_VERSION > '1.9' && defined?(Jbuilder)
         
     | 
| 
       12 
12 
     | 
    
         
             
              require 'gon/jbuilder'
         
     | 
| 
       13 
13 
     | 
    
         
             
            end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
         @@ -19,10 +19,6 @@ module Gon 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  @request_env['gon']
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                def all_variables=(values)
         
     | 
| 
       23 
     | 
    
         
            -
                  raise "You can't use Gon public methods for storing data"
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
22 
     | 
    
         
             
                def clear
         
     | 
| 
       27 
23 
     | 
    
         
             
                  @request_env['gon'] = {}
         
     | 
| 
       28 
24 
     | 
    
         
             
                end
         
     | 
| 
         @@ -48,7 +44,7 @@ module Gon 
     | 
|
| 
       48 
44 
     | 
    
         | 
| 
       49 
45 
     | 
    
         
             
                def method_missing(m, *args, &block)
         
     | 
| 
       50 
46 
     | 
    
         
             
                  if ( m.to_s =~ /=$/ )
         
     | 
| 
       51 
     | 
    
         
            -
                    if public_methods.include? m.to_s[0..-2].to_sym
         
     | 
| 
      
 47 
     | 
    
         
            +
                    if public_methods.include?(RUBY_VERSION > '1.9' ? m.to_s[0..-2].to_sym : m.to_s[0..-2])
         
     | 
| 
       52 
48 
     | 
    
         
             
                      raise "You can't use Gon public methods for storing data"
         
     | 
| 
       53 
49 
     | 
    
         
             
                    end
         
     | 
| 
       54 
50 
     | 
    
         
             
                    set_variable(m.to_s.delete('='), args[0])
         
     | 
| 
         @@ -65,50 +61,64 @@ module Gon 
     | 
|
| 
       65 
61 
     | 
    
         
             
                  @request_env['gon'][name] = value
         
     | 
| 
       66 
62 
     | 
    
         
             
                end
         
     | 
| 
       67 
63 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 64 
     | 
    
         
            +
                %w(rabl jbuilder).each do |builder_name|
         
     | 
| 
      
 65 
     | 
    
         
            +
                  define_method builder_name do |*options|
         
     | 
| 
      
 66 
     | 
    
         
            +
                    if options.first.is_a? String
         
     | 
| 
      
 67 
     | 
    
         
            +
                      warn "[DEPRECATION] view_path argument is now optional. If you need to specify it please use #{builder}(:template => 'path')"
         
     | 
| 
      
 68 
     | 
    
         
            +
                      options = options.extract_options!.merge(:template => options[0])
         
     | 
| 
      
 69 
     | 
    
         
            +
                    elsif options.first.is_a? Hash
         
     | 
| 
      
 70 
     | 
    
         
            +
                      options = options ? options.first : { }
         
     | 
| 
      
 71 
     | 
    
         
            +
                    else
         
     | 
| 
      
 72 
     | 
    
         
            +
                      raise ArgumentError.new("You pass wrong argument type to template generator method: #{options.first.class.to_s}")
         
     | 
| 
      
 73 
     | 
    
         
            +
                    end
         
     | 
| 
       73 
74 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                     
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                       
     | 
| 
      
 75 
     | 
    
         
            +
                    builder_module = get_builder(builder_name)
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                    data = builder_module.send("parse_#{builder_name}", get_template_path(options, builder_name), get_controller(options))
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                    if options[:as]
         
     | 
| 
      
 80 
     | 
    
         
            +
                      set_variable(options[:as].to_s, data)
         
     | 
| 
      
 81 
     | 
    
         
            +
                    elsif data.is_a? Hash
         
     | 
| 
      
 82 
     | 
    
         
            +
                      data.each do |key, value|
         
     | 
| 
      
 83 
     | 
    
         
            +
                        set_variable(key, value)
         
     | 
| 
      
 84 
     | 
    
         
            +
                      end
         
     | 
| 
      
 85 
     | 
    
         
            +
                    else
         
     | 
| 
      
 86 
     | 
    
         
            +
                      set_variable(builder_name, data)
         
     | 
| 
       84 
87 
     | 
    
         
             
                    end
         
     | 
| 
       85 
     | 
    
         
            -
                  else
         
     | 
| 
       86 
     | 
    
         
            -
                    set_variable('rabl', rabl_data)
         
     | 
| 
       87 
88 
     | 
    
         
             
                  end
         
     | 
| 
       88 
89 
     | 
    
         
             
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
                alias_method :orig_jbuilder, :jbuilder
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                def jbuilder(*options)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  raise NoMethodError.new('You can use Jbuilder support only in 1.9+') if RUBY_VERSION < '1.9'
         
     | 
| 
      
 94 
     | 
    
         
            +
                  orig_jbuilder(*options)
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                private
         
     | 
| 
       89 
98 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                def  
     | 
| 
       91 
     | 
    
         
            -
                   
     | 
| 
       92 
     | 
    
         
            -
                     
     | 
| 
       93 
     | 
    
         
            -
                   
     | 
| 
       94 
     | 
    
         
            -
                    raise NoMethodError.new( 
     | 
| 
      
 99 
     | 
    
         
            +
                def get_builder(builder_name)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 101 
     | 
    
         
            +
                    "Gon::#{builder_name.classify}".constantize
         
     | 
| 
      
 102 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 103 
     | 
    
         
            +
                    raise NoMethodError.new("You should define #{builder_name.classify} in your Gemfile")
         
     | 
| 
       95 
104 
     | 
    
         
             
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
       96 
106 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
                     
     | 
| 
      
 107 
     | 
    
         
            +
                def get_controller(options)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  options[:controller] ||
         
     | 
| 
      
 109 
     | 
    
         
            +
                    @request_env['action_controller.instance'] ||
         
     | 
| 
      
 110 
     | 
    
         
            +
                    @request_env['action_controller.rescue.response'].
         
     | 
| 
      
 111 
     | 
    
         
            +
                    instance_variable_get('@template').
         
     | 
| 
      
 112 
     | 
    
         
            +
                    instance_variable_get('@controller')
         
     | 
| 
      
 113 
     | 
    
         
            +
                end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                def get_template_path(options, extension)
         
     | 
| 
      
 116 
     | 
    
         
            +
                  if options[:template]
         
     | 
| 
      
 117 
     | 
    
         
            +
                    File.extname(options[:template]) == ".#{extension}" ? options[:template] : "#{options[:template]}.#{extension}"
         
     | 
| 
       108 
118 
     | 
    
         
             
                  else
         
     | 
| 
       109 
     | 
    
         
            -
                     
     | 
| 
      
 119 
     | 
    
         
            +
                    "app/views/#{get_controller(options).controller_path}/#{get_controller(options).action_name}.json.#{extension}"
         
     | 
| 
       110 
120 
     | 
    
         
             
                  end
         
     | 
| 
       111 
121 
     | 
    
         
             
                end
         
     | 
| 
       112 
     | 
    
         
            -
              end
         
     | 
| 
       113 
122 
     | 
    
         | 
| 
      
 123 
     | 
    
         
            +
              end
         
     | 
| 
       114 
124 
     | 
    
         
             
            end
         
     | 
    
        data/lib/gon/version.rb
    CHANGED
    
    
    
        data/spec/gon/gon_spec.rb
    CHANGED
    
    | 
         @@ -1,29 +1,33 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # gon_spec_rb
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'gon'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            describe Gon 
     | 
| 
      
 4 
     | 
    
         
            +
            describe Gon do
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       7 
7 
     | 
    
         
             
                Gon.request_env = {}
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
              describe '#all_variables' do
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                it 'returns all variables in hash' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  Gon.a = 1
         
     | 
| 
      
 14 
     | 
    
         
            +
                  Gon.b = 2
         
     | 
| 
      
 15 
     | 
    
         
            +
                  Gon.c = Gon.a + Gon.b
         
     | 
| 
      
 16 
     | 
    
         
            +
                  Gon.c.should == 3
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Gon.all_variables.should == {'a' => 1, 'b' => 2, 'c' => 3}
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                it 'supports all data types' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  Gon.clear
         
     | 
| 
      
 22 
     | 
    
         
            +
                  Gon.int = 1
         
     | 
| 
      
 23 
     | 
    
         
            +
                  Gon.float = 1.1
         
     | 
| 
      
 24 
     | 
    
         
            +
                  Gon.string = 'string'
         
     | 
| 
      
 25 
     | 
    
         
            +
                  Gon.array = [ 1, 'string' ]
         
     | 
| 
      
 26 
     | 
    
         
            +
                  Gon.hash_var = { :a => 1, :b => '2'}
         
     | 
| 
      
 27 
     | 
    
         
            +
                  Gon.hash_w_array = { :a => [ 2, 3 ] }
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Gon.klass = Hash
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
       17 
30 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              it 'supports all data types' do
         
     | 
| 
       19 
     | 
    
         
            -
                Gon.clear
         
     | 
| 
       20 
     | 
    
         
            -
                Gon.int = 1
         
     | 
| 
       21 
     | 
    
         
            -
                Gon.float = 1.1
         
     | 
| 
       22 
     | 
    
         
            -
                Gon.string = 'string'
         
     | 
| 
       23 
     | 
    
         
            -
                Gon.array = [ 1, 'string' ]
         
     | 
| 
       24 
     | 
    
         
            -
                Gon.hash_var = { :a => 1, :b => '2'}
         
     | 
| 
       25 
     | 
    
         
            -
                Gon.hash_w_array = { :a => [ 2, 3 ] }
         
     | 
| 
       26 
     | 
    
         
            -
                Gon.klass = Hash
         
     | 
| 
       27 
31 
     | 
    
         
             
              end
         
     | 
| 
       28 
32 
     | 
    
         | 
| 
       29 
33 
     | 
    
         
             
              describe '#include_gon' do
         
     | 
| 
         @@ -62,65 +66,154 @@ describe Gon, '#all_variables' do 
     | 
|
| 
       62 
66 
     | 
    
         
             
              it 'returns exception if try to set public method as variable' do
         
     | 
| 
       63 
67 
     | 
    
         
             
                Gon.clear
         
     | 
| 
       64 
68 
     | 
    
         
             
                lambda { Gon.all_variables = 123 }.should raise_error
         
     | 
| 
      
 69 
     | 
    
         
            +
                lambda { Gon.rabl = 123 }.should raise_error
         
     | 
| 
       65 
70 
     | 
    
         
             
              end
         
     | 
| 
       66 
71 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
               
     | 
| 
      
 72 
     | 
    
         
            +
              describe '.rabl' do
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                require 'rabl'
         
     | 
| 
      
 75 
     | 
    
         
            +
                require 'gon/rabl'
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       68 
77 
     | 
    
         
             
                before :each do
         
     | 
| 
       69 
78 
     | 
    
         
             
                  Gon.clear
         
     | 
| 
       70 
79 
     | 
    
         
             
                  controller.instance_variable_set('@objects', objects)
         
     | 
| 
       71 
80 
     | 
    
         
             
                end
         
     | 
| 
       72 
81 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                let(:controller) { ActionController::Base.new}
         
     | 
| 
       74 
     | 
    
         
            -
                let(:objects) { [1,2]}
         
     | 
| 
      
 82 
     | 
    
         
            +
                let(:controller) { ActionController::Base.new }
         
     | 
| 
      
 83 
     | 
    
         
            +
                let(:objects) { [1,2] }
         
     | 
| 
       75 
84 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                 
     | 
| 
       77 
     | 
    
         
            -
                   
     | 
| 
      
 85 
     | 
    
         
            +
                context 'render template with deprecation' do
         
     | 
| 
      
 86 
     | 
    
         
            +
                  it 'still works' do
         
     | 
| 
      
 87 
     | 
    
         
            +
                    Gon.rabl 'spec/test_data/sample.rabl', :controller => controller
         
     | 
| 
      
 88 
     | 
    
         
            +
                    Gon.objects.length.should == 2
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
       78 
90 
     | 
    
         
             
                end
         
     | 
| 
       79 
91 
     | 
    
         | 
| 
       80 
92 
     | 
    
         
             
                it 'works if rabl is included' do
         
     | 
| 
       81 
     | 
    
         
            -
                   
     | 
| 
       82 
     | 
    
         
            -
                  require 'gon/rabl'
         
     | 
| 
       83 
     | 
    
         
            -
                  Gon.rabl 'spec/test_data/sample.rabl', :controller => controller
         
     | 
| 
      
 93 
     | 
    
         
            +
                  Gon.rabl :template =>'spec/test_data/sample.rabl', :controller => controller
         
     | 
| 
       84 
94 
     | 
    
         
             
                  Gon.objects.length.should == 2
         
     | 
| 
       85 
95 
     | 
    
         
             
                end
         
     | 
| 
       86 
96 
     | 
    
         | 
| 
      
 97 
     | 
    
         
            +
                it 'raise exception if rabl is not included' do
         
     | 
| 
      
 98 
     | 
    
         
            +
                  Gon.send :remove_const, 'Rabl'
         
     | 
| 
      
 99 
     | 
    
         
            +
                  expect { Gon.rabl :template =>'spec/test_data/sample.rabl', :controller => controller}.to raise_error
         
     | 
| 
      
 100 
     | 
    
         
            +
                  load 'rabl.rb'
         
     | 
| 
      
 101 
     | 
    
         
            +
                  load 'gon/rabl.rb'
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                context '.get_template_path' do
         
     | 
| 
      
 105 
     | 
    
         
            +
                  context 'template is specified' do
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                    it 'add the extension if not included in the template name' do
         
     | 
| 
      
 108 
     | 
    
         
            +
                      Gon.send(:get_template_path, { :template => 'spec/test_data/sample'}, 'rabl').should eql('spec/test_data/sample.rabl')
         
     | 
| 
      
 109 
     | 
    
         
            +
                    end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                    it 'return the specified template' do
         
     | 
| 
      
 112 
     | 
    
         
            +
                      Gon.send(:get_template_path, { :template => 'spec/test_data/sample.rabl'}, 'rabl').should eql('spec/test_data/sample.rabl')
         
     | 
| 
      
 113 
     | 
    
         
            +
                    end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                  end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                  context 'template is not specified' do
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 120 
     | 
    
         
            +
                      Gon.clear
         
     | 
| 
      
 121 
     | 
    
         
            +
                      controller.instance_variable_set('@objects', objects)
         
     | 
| 
      
 122 
     | 
    
         
            +
                      controller.action_name = 'show'
         
     | 
| 
      
 123 
     | 
    
         
            +
                    end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                    let(:controller) { ActionController::Base.new }
         
     | 
| 
      
 126 
     | 
    
         
            +
                    let(:objects) { [1,2] }
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                    context 'the action doesn as a template at a different format' do
         
     | 
| 
      
 129 
     | 
    
         
            +
                      it 'return the same template as the action with rabl extension' do
         
     | 
| 
      
 130 
     | 
    
         
            +
                        Gon.send(:get_template_path, {:controller => controller}, 'rabl').should eql('app/views/action_controller/base/show.json.rabl')
         
     | 
| 
      
 131 
     | 
    
         
            +
                      end
         
     | 
| 
      
 132 
     | 
    
         
            +
                    end
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                  end
         
     | 
| 
      
 135 
     | 
    
         
            +
                end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
       87 
137 
     | 
    
         
             
              end
         
     | 
| 
       88 
138 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
              if RUBY_VERSION  
     | 
| 
      
 139 
     | 
    
         
            +
              if RUBY_VERSION > '1.9'
         
     | 
| 
       90 
140 
     | 
    
         
             
                require 'jbuilder'
         
     | 
| 
       91 
141 
     | 
    
         
             
                require 'gon/jbuilder'
         
     | 
| 
       92 
142 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                 
     | 
| 
       94 
     | 
    
         
            -
                   
     | 
| 
       95 
     | 
    
         
            -
                  controller = ActionController::Base.new
         
     | 
| 
       96 
     | 
    
         
            -
                  objects = [1,2]
         
     | 
| 
       97 
     | 
    
         
            -
                  controller.instance_variable_set('@objects', objects)
         
     | 
| 
       98 
     | 
    
         
            -
                  Gon.jbuilder 'spec/test_data/sample.json.jbuilder', :controller => controller
         
     | 
| 
       99 
     | 
    
         
            -
                  Gon.objects.length.should == 2
         
     | 
| 
       100 
     | 
    
         
            -
                end
         
     | 
| 
      
 143 
     | 
    
         
            +
                describe '.jbuilder' do
         
     | 
| 
      
 144 
     | 
    
         
            +
                  context 'render jbuilder templates' do
         
     | 
| 
       101 
145 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 146 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 147 
     | 
    
         
            +
                      Gon.clear
         
     | 
| 
      
 148 
     | 
    
         
            +
                      controller.instance_variable_set('@objects', objects)
         
     | 
| 
      
 149 
     | 
    
         
            +
                    end
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                    let(:controller) { ActionController::Base.new }
         
     | 
| 
      
 152 
     | 
    
         
            +
                    let(:objects) { [1,2] }
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                    it 'render json from jbuilder template' do
         
     | 
| 
      
 155 
     | 
    
         
            +
                      Gon.jbuilder 'spec/test_data/sample.json.jbuilder', :controller => controller
         
     | 
| 
      
 156 
     | 
    
         
            +
                      Gon.objects.length.should == 2
         
     | 
| 
      
 157 
     | 
    
         
            +
                    end
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                    it 'render json from jbuilder template with a partial' do
         
     | 
| 
      
 160 
     | 
    
         
            +
                      controller.view_paths << 'spec/test_data'
         
     | 
| 
      
 161 
     | 
    
         
            +
                      Gon.jbuilder 'spec/test_data/sample_with_partial.json.jbuilder', :controller => controller
         
     | 
| 
      
 162 
     | 
    
         
            +
                      Gon.objects.length.should == 2
         
     | 
| 
      
 163 
     | 
    
         
            +
                    end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                  end
         
     | 
| 
       111 
166 
     | 
    
         | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
      
 167 
     | 
    
         
            +
                  it 'should throw error if you use gon.jbuilder with ruby < 1.9+' do
         
     | 
| 
      
 168 
     | 
    
         
            +
                    RUBY_VERSION = '1.8.7'
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                    expect { Gon.jbuilder 'some_path'}.to raise_error(NoMethodError, /1.9/)
         
     | 
| 
      
 171 
     | 
    
         
            +
                  end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                  it 'should raise error if you use gon.jbuilder without requiring jbuilder gem' do
         
     | 
| 
      
 174 
     | 
    
         
            +
                    RUBY_VERSION = '1.9.2'
         
     | 
| 
      
 175 
     | 
    
         
            +
                    Gon.send(:remove_const, :Jbuilder)
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                    expect { Gon.jbuilder 'some_path' }.to raise_error(NoMethodError, /Gemfile/)
         
     | 
| 
      
 178 
     | 
    
         
            +
                    load 'jbuilder.rb'
         
     | 
| 
      
 179 
     | 
    
         
            +
                    load 'gon/jbuilder.rb'
         
     | 
| 
      
 180 
     | 
    
         
            +
                  end
         
     | 
| 
       114 
181 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
                  expect { Gon.jbuilder 'some_path' }.to raise_error(NoMethodError, /1.9/)
         
     | 
| 
       116 
182 
     | 
    
         
             
                end
         
     | 
| 
       117 
183 
     | 
    
         | 
| 
       118 
     | 
    
         
            -
                 
     | 
| 
       119 
     | 
    
         
            -
                   
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
      
 184 
     | 
    
         
            +
                describe '.get_template_path' do
         
     | 
| 
      
 185 
     | 
    
         
            +
                  context 'template is specified' do
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                    it 'add the extension if not included in the template name' do
         
     | 
| 
      
 188 
     | 
    
         
            +
                      Gon.send(:get_template_path, { :template => 'spec/test_data/sample'}, 'jbuilder').should eql('spec/test_data/sample.jbuilder')
         
     | 
| 
      
 189 
     | 
    
         
            +
                    end
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                    it 'return the specified template' do
         
     | 
| 
      
 192 
     | 
    
         
            +
                      Gon.send(:get_template_path, { :template => 'spec/test_data/sample.jbuilder'}, 'jbuilder').should eql('spec/test_data/sample.jbuilder')
         
     | 
| 
      
 193 
     | 
    
         
            +
                    end
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
                  end
         
     | 
| 
       121 
196 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
                   
     | 
| 
      
 197 
     | 
    
         
            +
                  context 'template is not specified' do
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 200 
     | 
    
         
            +
                      Gon.clear
         
     | 
| 
      
 201 
     | 
    
         
            +
                      controller.instance_variable_set('@objects', objects)
         
     | 
| 
      
 202 
     | 
    
         
            +
                      controller.action_name = 'show'
         
     | 
| 
      
 203 
     | 
    
         
            +
                    end
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
                    let(:controller) { ActionController::Base.new }
         
     | 
| 
      
 206 
     | 
    
         
            +
                    let(:objects) { [1,2] }
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                    context 'the action doesn as a template at a different format' do
         
     | 
| 
      
 209 
     | 
    
         
            +
                      it 'return the same template as the action with rabl extension' do
         
     | 
| 
      
 210 
     | 
    
         
            +
                        Gon.send(:get_template_path, {:controller => controller}, 'jbuilder').should eql('app/views/action_controller/base/show.json.jbuilder')
         
     | 
| 
      
 211 
     | 
    
         
            +
                      end
         
     | 
| 
      
 212 
     | 
    
         
            +
                    end
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
      
 214 
     | 
    
         
            +
                  end
         
     | 
| 
       123 
215 
     | 
    
         
             
                end
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
       124 
217 
     | 
    
         
             
              end
         
     | 
| 
       125 
218 
     | 
    
         | 
| 
       126 
219 
     | 
    
         
             
              def request
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,79 +1,118 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: gon
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 7
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 9 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 2.2.0
         
     | 
| 
       6 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
     | 
    
         
            -
            authors:
         
     | 
| 
      
 12 
     | 
    
         
            +
            authors: 
         
     | 
| 
       8 
13 
     | 
    
         
             
            - gazay
         
     | 
| 
       9 
14 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2012-03-07 00:00:00 Z
         
     | 
| 
      
 19 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       15 
21 
     | 
    
         
             
              name: actionpack
         
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
      
 22 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 23 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
       17 
24 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
     | 
    
         
            -
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - -  
     | 
| 
       20 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 25 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 26 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 27 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 29 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 30 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 31 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 32 
     | 
    
         
            +
                    - 0
         
     | 
| 
       21 
33 
     | 
    
         
             
                    version: 2.3.0
         
     | 
| 
       22 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 36 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       26 
37 
     | 
    
         
             
              name: json
         
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
      
 38 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 39 
     | 
    
         
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
       28 
40 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
     | 
    
         
            -
                requirements:
         
     | 
| 
       30 
     | 
    
         
            -
                - -  
     | 
| 
       31 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
     | 
    
         
            -
                     
     | 
| 
      
 41 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 42 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 43 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 44 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 45 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 46 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
       33 
48 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 49 
     | 
    
         
            +
              version_requirements: *id002
         
     | 
| 
      
 50 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       37 
51 
     | 
    
         
             
              name: rabl
         
     | 
| 
       38 
     | 
    
         
            -
               
     | 
| 
      
 52 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 53 
     | 
    
         
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
       39 
54 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
     | 
    
         
            -
                requirements:
         
     | 
| 
       41 
     | 
    
         
            -
                - -  
     | 
| 
       42 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       43 
     | 
    
         
            -
                     
     | 
| 
      
 55 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 56 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 57 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 58 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 59 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 60 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
       44 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       45 
     | 
    
         
            -
               
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 63 
     | 
    
         
            +
              version_requirements: *id003
         
     | 
| 
      
 64 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       48 
65 
     | 
    
         
             
              name: rspec
         
     | 
| 
       49 
     | 
    
         
            -
               
     | 
| 
      
 66 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 67 
     | 
    
         
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
       50 
68 
     | 
    
         
             
                none: false
         
     | 
| 
       51 
     | 
    
         
            -
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - -  
     | 
| 
       53 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                     
     | 
| 
      
 69 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 70 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 71 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 72 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 73 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 74 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
       55 
76 
     | 
    
         
             
              type: :development
         
     | 
| 
       56 
     | 
    
         
            -
               
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 77 
     | 
    
         
            +
              version_requirements: *id004
         
     | 
| 
      
 78 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       59 
79 
     | 
    
         
             
              name: jbuilder
         
     | 
| 
       60 
     | 
    
         
            -
               
     | 
| 
      
 80 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 81 
     | 
    
         
            +
              requirement: &id005 !ruby/object:Gem::Requirement 
         
     | 
| 
       61 
82 
     | 
    
         
             
                none: false
         
     | 
| 
       62 
     | 
    
         
            -
                requirements:
         
     | 
| 
       63 
     | 
    
         
            -
                - -  
     | 
| 
       64 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       65 
     | 
    
         
            -
                     
     | 
| 
      
 83 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 84 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 85 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 86 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 87 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 88 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
       66 
90 
     | 
    
         
             
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              version_requirements: *id005
         
     | 
| 
      
 92 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 93 
     | 
    
         
            +
              name: rake
         
     | 
| 
       67 
94 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       68 
     | 
    
         
            -
               
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
              requirement: &id006 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 96 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 97 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 98 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 99 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 100 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 101 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 102 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              version_requirements: *id006
         
     | 
| 
      
 106 
     | 
    
         
            +
            description: If you need to send some data to your js files and you don't want to do this with long way trough views and parsing - use this force!
         
     | 
| 
      
 107 
     | 
    
         
            +
            email: 
         
     | 
| 
       72 
108 
     | 
    
         
             
            - alex.gaziev@gmail.com
         
     | 
| 
       73 
109 
     | 
    
         
             
            executables: []
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
       74 
111 
     | 
    
         
             
            extensions: []
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
       75 
113 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            files: 
         
     | 
| 
       77 
116 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       78 
117 
     | 
    
         
             
            - .travis.yml
         
     | 
| 
       79 
118 
     | 
    
         
             
            - Gemfile
         
     | 
| 
         @@ -95,29 +134,38 @@ files: 
     | 
|
| 
       95 
134 
     | 
    
         
             
            - spec/test_data/sample_with_partial.json.jbuilder
         
     | 
| 
       96 
135 
     | 
    
         
             
            homepage: https://github.com/gazay/gon
         
     | 
| 
       97 
136 
     | 
    
         
             
            licenses: []
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
       98 
138 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       99 
139 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
       101 
142 
     | 
    
         
             
            - lib
         
     | 
| 
       102 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 143 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       103 
144 
     | 
    
         
             
              none: false
         
     | 
| 
       104 
     | 
    
         
            -
              requirements:
         
     | 
| 
       105 
     | 
    
         
            -
              - -  
     | 
| 
       106 
     | 
    
         
            -
                - !ruby/object:Gem::Version
         
     | 
| 
       107 
     | 
    
         
            -
                   
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
      
 145 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 146 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 147 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 148 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 149 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 150 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 151 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 152 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       109 
153 
     | 
    
         
             
              none: false
         
     | 
| 
       110 
     | 
    
         
            -
              requirements:
         
     | 
| 
       111 
     | 
    
         
            -
              - -  
     | 
| 
       112 
     | 
    
         
            -
                - !ruby/object:Gem::Version
         
     | 
| 
       113 
     | 
    
         
            -
                   
     | 
| 
      
 154 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 155 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 156 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 157 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 158 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 159 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 160 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
       114 
161 
     | 
    
         
             
            requirements: []
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
       115 
163 
     | 
    
         
             
            rubyforge_project: gon
         
     | 
| 
       116 
164 
     | 
    
         
             
            rubygems_version: 1.8.15
         
     | 
| 
       117 
165 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       118 
166 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       119 
167 
     | 
    
         
             
            summary: Get your Rails variables in your JS
         
     | 
| 
       120 
     | 
    
         
            -
            test_files:
         
     | 
| 
      
 168 
     | 
    
         
            +
            test_files: 
         
     | 
| 
       121 
169 
     | 
    
         
             
            - spec/gon/gon_spec.rb
         
     | 
| 
       122 
170 
     | 
    
         
             
            - spec/test_data/_sample_partial.json.jbuilder
         
     | 
| 
       123 
171 
     | 
    
         
             
            - spec/test_data/sample.json.jbuilder
         
     |