lib/linkedin/industry.rb in linkedin2-0.0.13 vs lib/linkedin/industry.rb in linkedin2-0.0.14
- old
+ new
@@ -15,9 +15,19 @@
def self.find_by_group(*groups)
all.reject { |indust| (groups & indust[:group]) != groups }
end
def self.find_by_description(description)
- all.detect { |indust| indust[:description].to_s.downcase == description.to_s.downcase }
+ all.detect { |indust| normalize_description(indust[:description]) == normalize_description(description) }
+ end
+
+ def self.find_group_names(*groups)
+ Array[groups].flatten.map { |group| LinkedIn::API::Industries::GROUPS[group.to_sym] }
+ end
+
+ private
+
+ def self.normalize_description(description)
+ description.to_s.downcase.strip.gsub(' ','_').gsub(/[^\w]/, '').to_sym
end
end
end