lib/rixml.rb in rixml-0.1.0 vs lib/rixml.rb in rixml-0.1.1

- old
+ new

@@ -92,14 +92,16 @@ end end def parse_companies_from_context(context) companies = [] - list = context['IssuerDetails'].try(:[], 'Issuer') - return [] if list.nil? - list = [list] unless list.is_a? Array - list.select { |c| c['issuerType'] == 'Corporate' }.each do |company| - companies << parse_company_info(company) + [context['IssuerDetails']].flatten.compact.each do |issuer| + list = issuer.try(:[], 'Issuer') + next if list.nil? + list = [list] unless list.is_a? Array + list.select { |c| c['issuerType'] == 'Corporate' }.each do |company| + companies << parse_company_info(company) + end end companies end def parse_company_info(company)