lib/gon.rb in gon-3.0.5 vs lib/gon.rb in gon-4.0.0
- old
+ new
@@ -3,27 +3,32 @@
end
require 'action_view'
require 'action_controller'
require 'gon/base'
require 'gon/global'
+require 'gon/watch'
require 'gon/request'
require 'gon/helpers'
require 'gon/escaper'
if defined?(Rabl)
require 'gon/rabl'
end
if defined?(Jbuilder)
require 'gon/jbuilder'
end
-module Gon
+class Gon
class << self
def global
Gon::Global
end
+ def watch
+ Gon::Watch
+ end
+
def method_missing(method, *args, &block)
if ( method.to_s =~ /=$/ )
if public_method_name? method
raise "You can't use Gon public methods for storing data"
end
@@ -41,15 +46,21 @@
def clear
Request.clear
end
def rabl(*args)
+ unless Gon.constants.include?(:Rabl)
+ raise "Possible wrong require order problem - try to add `gem 'rabl'` before `gem 'gon'` in your Gemfile"
+ end
data, options = Gon::Rabl.handler(args)
store_builder_data 'rabl', data, options
end
def jbuilder(*args)
+ unless Gon.constants.include?(:Jbuilder)
+ raise "Possible wrong require order problem - try to add `gem 'jbuilder'` before `gem 'gon'` in your Gemfile"
+ end
data, options = Gon::Jbuilder.handler(args)
store_builder_data 'jbuilder', data, options
end