R
Rick Jones
I have been working on this code for a few days and can't seem to figure
out what I am doing wrong... Labeling gruff is pretty easy for the most
part (just put it in hash format) but I can't get this to work for
anything...
This is basically the code that I am working on:
I won't go through the code to get the first input and the last input
for both the hour and the minute, but I am fine on that part of the code
and I named them: last_min_hour, last_time_min, last_time_hour and
first_time_min.
count_incr += 0
access_bar_hash = Hash.new(0)
time_regex = /d{1,2}:[5][0]/ # looks for only 50 minute intervals
reads = 60 # this will change based on how many times the program runs
label_spacing = 60/reads # 60 is how many columns there are
final_last_time = [last_time_hour, last_time_min].join(":")
final_first_time = [first_time_hour, first_time_min].join(":")
incr_hash[count_incr] = final_first_time
while count_incr < 8 # the 8 will actually be dynamic, but use this for
now
if incr_hash[count_incr] =~ time_regex
first_time_hour += 1
first_time_min = '00'
else
first_time_min = first_time_min.to_i
first_time_min += 10
end
count_incr += 1
incr_hash[count_incr] = [first_time_hour, first_time_min].join(":")
spacer = label_spacing * (count_reads)
access_bar_hash[(label_spacing * count_incr)] =
incr_hash[count_incr]
end
access_bar.labels = access_bar_hash
----
What I don't understand is that if i take the output of what
access_bar_hash gives me, it input that directly into the
access_bar.labels, this works perfect. But I must be putting this into
the hash wrong somehow... Can anyone take a look at this and give me
some help?
out what I am doing wrong... Labeling gruff is pretty easy for the most
part (just put it in hash format) but I can't get this to work for
anything...
This is basically the code that I am working on:
I won't go through the code to get the first input and the last input
for both the hour and the minute, but I am fine on that part of the code
and I named them: last_min_hour, last_time_min, last_time_hour and
first_time_min.
count_incr += 0
access_bar_hash = Hash.new(0)
time_regex = /d{1,2}:[5][0]/ # looks for only 50 minute intervals
reads = 60 # this will change based on how many times the program runs
label_spacing = 60/reads # 60 is how many columns there are
final_last_time = [last_time_hour, last_time_min].join(":")
final_first_time = [first_time_hour, first_time_min].join(":")
incr_hash[count_incr] = final_first_time
while count_incr < 8 # the 8 will actually be dynamic, but use this for
now
if incr_hash[count_incr] =~ time_regex
first_time_hour += 1
first_time_min = '00'
else
first_time_min = first_time_min.to_i
first_time_min += 10
end
count_incr += 1
incr_hash[count_incr] = [first_time_hour, first_time_min].join(":")
spacer = label_spacing * (count_reads)
access_bar_hash[(label_spacing * count_incr)] =
incr_hash[count_incr]
end
access_bar.labels = access_bar_hash
----
What I don't understand is that if i take the output of what
access_bar_hash gives me, it input that directly into the
access_bar.labels, this works perfect. But I must be putting this into
the hash wrong somehow... Can anyone take a look at this and give me
some help?