Class: Sudo::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/sudo/proxy.rb

Instance Method Summary collapse

Instance Method Details

#add_load_path(path) ⇒ Object



35
36
37
# File 'lib/sudo/proxy.rb', line 35

def add_load_path(path)
  $LOAD_PATH << path
end

#load_pathObject



31
32
33
# File 'lib/sudo/proxy.rb', line 31

def load_path
  $LOAD_PATH
end

#loaded_specsObject



22
23
24
25
26
27
28
29
# File 'lib/sudo/proxy.rb', line 22

def loaded_specs
  # Return only the keys (gem names) to avoid marshaling StubSpecification objects
  # which can fail in newer Bundler versions
  Gem.loaded_specs.keys
rescue => e
  warn "Warning: Could not get loaded gem specs (#{e.class}: #{e.message}). Returning empty list."
  []
end

#proxy(object, method = :itself, *args, &blk) ⇒ Object



18
19
20
# File 'lib/sudo/proxy.rb', line 18

def proxy(object, method = :itself, *args, &blk)
  object.send method, *args, &blk
end