Class: RubyProxy::ProxyLoad

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_proxy/proxy_load.rb

Constant Summary collapse

@@logger =
Logger.new(STDOUT)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.load_pathObject

Returns the value of attribute load_path.



8
9
10
# File 'lib/ruby_proxy/proxy_load.rb', line 8

def load_path
  @load_path
end

Class Method Details

.loadObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ruby_proxy/proxy_load.rb', line 9

def load
  load_path.uniq.each do |p|
    if File.directory?(p)
      Dir[p.chomp("/") + "/*.rb"].each do |file|
        load_file(file)
      end
    elsif File.file?(p)
      load_file(p)
    else
      @@logger.warn("path: #{p} not exist ,ignore")
    end
  
  end
end

.load_file(file) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/ruby_proxy/proxy_load.rb', line 24

def load_file(file)
  @@logger.debug "require file : #{file}"
  Kernel.require file
rescue LoadError
  @@logger.warn "require file : #{file} fail,exception:"
  @@logger.warn "#{$!}"
end