T
Tim Wolak
I'm not sure if I'm using this the right way and I'm hoping you guys can
help.
I am merging two hashes together using merge and need to keep the keys
the same and subtract the difference between the two values. The keys
are account numbers and the values are the balances. Not sure why the
balances are not subtracting and creating the new value.
Thanks in advance.
Tim
class Calculate
attr_reader :sktyfuta, :sktyfutb
def initialize(sktyfuta, sktyfutb)
@sktyfuta = sktyfuta
@sktyfutb = sktyfutb
end
def data_comp
@sktyfuta.merge(@sktyfutb) { |key, old_value, new_value| old_value
- new_value }
end
end
help.
I am merging two hashes together using merge and need to keep the keys
the same and subtract the difference between the two values. The keys
are account numbers and the values are the balances. Not sure why the
balances are not subtracting and creating the new value.
Thanks in advance.
Tim
class Calculate
attr_reader :sktyfuta, :sktyfutb
def initialize(sktyfuta, sktyfutb)
@sktyfuta = sktyfuta
@sktyfutb = sktyfutb
end
def data_comp
@sktyfuta.merge(@sktyfutb) { |key, old_value, new_value| old_value
- new_value }
end
end