Module: Padrino::Performance::JSON

Defined in:
padrino-performance/lib/suites/json.rb

Defined Under Namespace

Modules: InfectedRequire

Class Method Summary collapse

Class Method Details

.infect_require!Object


43
44
45
# File 'padrino-performance/lib/suites/json.rb', line 43

def self.infect_require!
  Object.send(:include, InfectedRequire)
end

.loaded_lib!(lib) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'padrino-performance/lib/suites/json.rb', line 24

def self.loaded_lib!(lib)
  loaded_libs[lib] = caller

  if loaded_libs.size >= 2
    warn <<-WARN
Concurring json libraries have been loaded. This incurs an
unneccessary memory overhead at should be avoided. Consult the
following call stacks to see who loaded the offending libraries
and contact the authors if necessary:"
WARN
    loaded_libs.each do |name, stack|
      $stderr.puts "=================="
      $stderr.puts "libname: " + name
      $stderr.puts "=================="
      $stderr.puts caller
    end
  end
end

.loaded_libsObject


16
17
18
# File 'padrino-performance/lib/suites/json.rb', line 16

def self.loaded_libs
  @loaded_libs ||= {}
end

.registered_libsObject

InfectedRequire


12
13
14
# File 'padrino-performance/lib/suites/json.rb', line 12

def self.registered_libs
  @registered_libs ||= []
end

.setup_captures!(*libs) ⇒ Object


20
21
22
# File 'padrino-performance/lib/suites/json.rb', line 20

def self.setup_captures!(*libs)
  @registered_libs = libs
end