Skip to content

Instantly share code, notes, and snippets.

@murphybytes
Created May 31, 2012 17:49
Show Gist options
  • Save murphybytes/2845020 to your computer and use it in GitHub Desktop.
Save murphybytes/2845020 to your computer and use it in GitHub Desktop.
Hack for mongoid version differences
def self.npv_item_for_security_id sec_id, swap_prices
npv_items = swap_prices.npv_items.select do |item|
item['symbol'].eql?(sec_id)
end
return nil if npv_items.empty?
npv_item = npv_items.last
npv_item = npv_item.as_document unless npv_item.is_a?(Hash)
Java::Eris::NpvItem.from_h(npv_item)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment