Thanks John, for the method_missing explanation, that makes more sense
now, and it works, but only if I do the following: notice :signal_index
@signals = []
attr_reader :signals
@signals << Signal.new
@signals[signal_index].add_variable(:signal_index, signal_index)
framework.write_log("Signal
Index:#{framework.binary.signals[0].signal_index}")
if I do: notice 'signal_index'
@signals[signal_index].add_variable('signal_index', signal_index)
framework.write_log("Signal
Index:#{framework.binary.signals[0].signal_index}")
it says no method error.
1.) So : or ' ', one is symbol one is string, i didn't think that would
make a difference? I'm not sure if that is a side affect of me having
all these objects buried, like I have a framework object that makes a
binary object that then houses the functions you gave me. And I am
accessing those variables from a ruby script that is outside of all that
mess, which is why i have a hierarchy of object calls....
2.) Is there a way to make the 'signal_index' a variable? I would like
to be able to store the contents of a variable as the name that is then
associated with a value.
like this possibly? I want the contents of parameter_name to be the
label or name associated with the contents of the variable
parameter_value
@signals[signal_index].add_variable(#{parameter_name}, parameter_value)
3.) Also, If I wanted to print all key value pairs in the @variables, in
an understandable format just to prove and see that they are all there,
how would you do that, without first knowing which variables were stored
that time around.
Would I iterate through @variables ? for all the names, and through
@values for all the values? I guess I don't fully understand how the
embedded array of repeating fields is arranged and where it is located
within @values and @variables. So how would you also handle printing
that embedded second array of repeating values and names?
Sorry I am new to Ruby, and I do appreciate your help.
-Matt
--
Posted via http://www.ruby-forum.com/.