Extend an object with module stored
- From: Andrea Reginato <andrea.reginato@xxxxxxxxx>
- Date: Wed, 1 Feb 2006 01:11:01 +0900
I would like extend dynamically an object with one or more Module that I
save into an Hash (I now only this way).
-----------------------------
categorie << Categoria.new('Definizioni Testuali', {:name_module =>
ListaDefinizioni, })
categorie << Categoria.new('Definizioni Testuali', {:name_module =>
ListaDefinizioni, :name_module => ListaDefinizioniEditor})
-----------------------------
Then I have store this information in a YAML file, but when I dump the
hash I lost the info about the module.
-----------------------------
--- !ruby/array:Categorie
- !ruby/object:Categoria
descrizione: Definizioni Testuali
estensioni: # MY HASH
:name_module: !ruby/object:Module {}
- !ruby/object:Categoria
descrizione: Definizioni Testuali
estensioni: # MY HASH
:name_module: !ruby/object:Module {}
-----------------------------
So when I try to extend, nothing to do.
This code do not give me errors, but it do not extend my object.
-----------------------------
# @categoria.extension is the hash with the module
@categoria.estensioni.each_value { |estensione| @denotato.send('extend',
estensione) }
-----------------------------
Do you know some tecnique to extend an Object with module stored in YAML
file?
Thanks so much to all for the help.
--Reis
--
Posted via http://www.ruby-forum.com/.
.
- Follow-Ups:
- Re: Extend an object with module stored
- From: Eero Saynatkari
- Re: Extend an object with module stored
- From: Joel VanderWerf
- Re: Extend an object with module stored
- Prev by Date: Re: Ruby tutorials w/ excercises
- Next by Date: Beginner question on classes on different files
- Previous by thread: getting hostname from ruby
- Next by thread: Re: Extend an object with module stored
- Index(es):
Relevant Pages
|