Module: Gon

Defined in:
lib/gon.rb,
lib/gon/base.rb,
lib/gon/rabl.rb,
lib/gon/global.rb,
lib/gon/escaper.rb,
lib/gon/helpers.rb,
lib/gon/request.rb,
lib/gon/version.rb,
lib/gon/jbuilder.rb

Defined Under Namespace

Modules: Base, Escaper, Global, GonHelpers, Helpers, Jbuilder, Rabl, Request

Constant Summary collapse

VERSION =
'3.0.2'

Class Method Summary collapse

Class Method Details

.all_variablesObject


37
38
39
# File 'lib/gon.rb', line 37

def all_variables
  Request.gon
end

.clearObject


41
42
43
# File 'lib/gon.rb', line 41

def clear
  Request.clear
end

.globalObject


21
22
23
# File 'lib/gon.rb', line 21

def global
  Gon::Global
end

.inspectObject


57
58
59
# File 'lib/gon.rb', line 57

def inspect
  'Gon'
end

.jbuilder(*args) ⇒ Object


51
52
53
54
55
# File 'lib/gon.rb', line 51

def jbuilder(*args)
  data, options = Gon::Jbuilder.handler(args)

  store_builder_data 'jbuilder', data, options
end

.method_missing(method, *args, &block) ⇒ Object


25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gon.rb', line 25

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

    set_variable(method.to_s.delete('='), args[0])
  else
    get_variable(method.to_s)
  end
end

.rabl(*args) ⇒ Object


45
46
47
48
49
# File 'lib/gon.rb', line 45

def rabl(*args)
  data, options = Gon::Rabl.handler(args)

  store_builder_data 'rabl', data, options
end