On Mon, Sep 21, 2009 at 6:27 PM, Matt Brooks <mattbrooks / gatech.edu> wrote:
> So I guess technically the way to phrase it is, incrementing method
> names... my bad.
>
> Also, I tried both ways, neither seemed to work... It just outputs
> nothing, and there is not even an error, I tried to catch an error and
> there wasn't one, the output just says pan_data_bin_0 through
> pan_data_bin_49, without any data after the colon.
>
> Excuse the calls from object to object, I got tired of stripping the
> code.        > created...
>
> I think we are on the right track though...Did I implement one of these
> incorrectly?
>
>
> framework.binary.pan_data_signals[index_pan_data_signal].num_bins.times
> do |bin_number_index|
> value =
> framework.binary.pan_data_signals[index_pan_data_signal].send("bin_#{bin_number_index}")
> framework.write_log("Pan Data Bin_\##{bin_number_index}: #{value}")
> end
>

Looks good. Check this:

irb(main):032:0> class BinarySignal
irb(main):033:1> def bin_0
irb(main):034:2> "bin_0_data"
irb(main):035:2> end
irb(main):036:1> def bin_1
irb(main):037:2> "bin_1_data"
irb(main):038:2> end
irb(main):039:1> def bin_2
irb(main):040:2> "bin_2_data"
irb(main):041:2> end
irb(main):042:1> end
irb(main):046:0> bin = BinarySignal.new
=> #<BinarySignal:0xb7dcc5a0>

irb(main):056:0> 3.times do |index|
irb(main):057:1* puts "Bin data \##{index}: #{bin.send("bin_#{index}")}"
irb(main):058:1> end
Bin data #0: bin_0_data
Bin data #1: bin_1_data
Bin data #2: bin_2_data


So I assume that some assumption is incorrect. Can you put some traces there?
p framework.binary.pan_data_signals[index_pan_data_signal]

Are you sure that object responds to bin_xxx and returns something
that is printable?
If you are handling those calls with method missing and looking in a
Hash, maybe the hash is empty for that key, returning nil, and that's
why we see nothing:

irb(main):059:0> class BinarySignal
irb(main):060:1> def bin_0
irb(main):061:2> nil
irb(main):062:2> end
irb(main):063:1> def bin_1
irb(main):064:2> nil
irb(main):065:2> end
irb(main):066:1> def bin_2
irb(main):067:2> nil
irb(main):068:2> end
irb(main):069:1> end
=> nil
irb(main):070:0> bin = BinarySignal.new
=> #<BinarySignal:0xb7df3b8c>
irb(main):071:0> 3.times do |index|
irb(main):072:1* puts "Bin data \##{index}: #{bin.send("bin_#{index}")}"
irb(main):073:1> end
Bin data #0:
Bin data #1:
Bin data #2:

If I were you I would try to make sure that internal hash is correctly
filled for that object. Maybe print it also before the loop, to see
what's inside.

Jesus.