Method: Padrino.gem

Defined in:
padrino-core/lib/padrino-core.rb

.gem(name, main_module) ⇒ Object

Registers a gem with padrino. This relieves the caller from setting up loadpaths by itself and enables Padrino to look up apps in gem folder.

The name given has to be the proper gem name as given in the gemspec.

Parameters:

  • name (String)

    The name of the gem being registered.

  • main_module (Module)

    The main module of the gem.



180
181
182
183
184
185
# File 'padrino-core/lib/padrino-core.rb', line 180

def gem(name, main_module)
  _, spec = Gem.loaded_specs.find{|spec_pair| spec_pair[0] == name }
  gems << spec
  modules << main_module
  spec.full_gem_path
end