lib/quakelive_api/parser/awards.rb in quakelive_api-0.0.1 vs lib/quakelive_api/parser/awards.rb in quakelive_api-0.1.0

- old
+ new

@@ -13,33 +13,33 @@ document.css(selector(:unearned)).map { |node| parse_node(node) } end private - def selectors - { - :earned => ".detailArea", - :unearned => ".detailArea_off" - } - end + def selectors + { + earned: ".detailArea", + unearned: ".detailArea_off" + } + end - def parse_node(node) - attrs = { - :icon => node.at('img')['src'], - :info => node.at('img')['title'], - :name => node.at('span.bigRedTxt').content, - :description => node.at('span.blktxt_11').content, - :awarded => awarded_at(node) - } - Items::Award.new(attrs) - end + def parse_node(node) + attrs = { + icon: node.at('img')['src'], + info: node.at('img')['title'], + name: node.at('span.bigRedTxt').content, + description: node.at('span.blktxt_11').content, + awarded: awarded_at(node) + } + Items::Award.new(attrs) + end - def awarded_at(node) - return unless node.css('ul.fl li').count >= 3 + def awarded_at(node) + return unless node.css('ul.fl li').count >= 3 - matches = node.at('ul.fl li:first-child').content.match(/(\d{2})\/(\d{2})\/(\d{4})/) - Date.new(matches[3].to_i, matches[1].to_i, matches[2].to_i) unless matches.nil? - end + matches = node.at('ul.fl li:first-child').content.match(/(\d{2})\/(\d{2})\/(\d{4})/) + Date.new(matches[3].to_i, matches[1].to_i, matches[2].to_i) unless matches.nil? + end end class CareerMilestones < Awards; end class Experience < Awards; end class MadSkillz < Awards; end