0
I have some variables that repeat a lot and I would like to group them into one definition, to be called by several other definitions.
Example:
module Andre
module Dialogos
def self.um
puts "estou em um"
self.dois #chamar tudo da definição dois
puts "#{vogais}"
puts "estava em dois, agora estou em um."
self.tres
end
def self.dois
vogais = "estou em dois"
consoantes = "b, c, d, e, f"
end
def self.tres
puts "estou em tres"
self.dois #chamar tudo da definição dois
puts "#{consoantes}"
puts "estava em dois, voltei para o três"
end
self.um
end
end
In this case, an error occurs because it is not possible to know who are vowels and consonants, so the code only displays the first puts.
I would like to call the vowel variable of definition two and continue doing my calculations in setting one.