Forum: Rails-ES Usar gem en lugar de require_gem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E3381162d15b1e7d6c8288af471751d4?d=identicon&s=25 lumen (Guest)
on 2007-02-19 21:13
(Received via mailing list)
Hola de nuevo:

Resulta que todos los require_gem me sueltan un warning, diciendo que
está
deprecated y que use en su lugar 'gem'.

Lo que pasa es que usando gem, parece que no se me hacen visibles las
clases de la gema:


irb(main):003:0* require 'rubygems'
=> true
irb(main):004:0> gem 'vpim'
=> true
irb(main):006:0> cal = Vpim::Icalendar.parse( File.open(
'fixtures/zutano_mengano_lun_vier.ics' ) )
NameError: uninitialized constant Vpim
        from (irb):7
irb(main):007:0>


En cambio con require_gem me funciona bien:


irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'vpim'
(irb):2:Warning: require_gem is obsolete.  Use gem instead.
=> true
irb(main):003:0> cal = Vpim::Icalendar.decode( File.open(
'fixtures/zutano_mengano_lun_vier.ics' ) )
irb(main):004:0> cal = Vpim::Icalendar.decode( File.open(
'fixtures/zutano_mengano_lun_vier.ics' ) )
=> [#<Vpim::Icalendar:0xb7803344
@components=[#<Vpim::Icalendar::Vevent:0xb780309c
@properties=#<Vpim::DirectoryInfo:0xb7803010
@fields=[#<Vpim::DirectoryInfo::Field:0xb780e014 @group=nil,
@value="VEVENT", @line="BEGIN:VEVENT", @params={}, @name="BEGIN">,
#<Vpim::DirectoryInfo::Field:0xb780deac @group=nil,
@value="20070219T193309Z", @line="DTSTAMP:20070219T193309Z", @params={},
@name="DTSTAMP">,
...
...


porquè ?
7223c62b7310e164eb79c740188abbda?d=identicon&s=25 Xavier Noria (Guest)
on 2007-02-19 21:46
(Received via mailing list)
On Feb 19, 2007, at 9:12 PM, lumen wrote:

> => true
>
>
> irb(main):001:0> require 'rubygems'
> => true
> irb(main):002:0> require_gem 'vpim'

No hay que usar ni gem ni require_gem en general, tan solo require.

-- fxn
This topic is locked and can not be replied to.