The chart data is stored in a nested dictionary struct @line_charts, and I need to convert the prices to target currency with the function exchange_datasets_currency. It should finally return the @chart in the end of method.Is there any way to improve my pattern?def sample_a    @line_charts = [get_line_chart(@from, @to, flight_date, price, tixs)]    exchange_datasets_currency(@line_charts.first[:datasets], @flights.first)    @line_chartsenddef sample_b    @line_chart = _build_line_chart(@from, @to, union_keys, datasets)    exchange_datasets_currency(@line_chart[:datasets], @flight)    @line_chartend  def exchange_datasets_currency(datasets, flight)    datasets.each do |item|      item[:data] = item[:data].collect do |price|        if price.nil?          nil        else          country = LocationUtils.instance.get_country(flight.from)          from_currency = LocationUtils.instance.get_currency(country)          Money.new(price,from_currency).exchange_to(TWD).cents        end      end    end  end
Monkey patch data in dictionary
ruby;design patterns