Sha256: 325cf90a6436bfd2b1e78edd40447015f2a2d458e49c2f0527e87457b74137f6
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 Bytes
Contents
require "hmc_outlets/version" require "open-uri" require "nokogiri" module HmcOutlets CERTIFIED_OUTLETS_URI = "http://www.halalhmc.org/certified-outlets-results.htm#result" def self.certified?(outlet_name) certified_outlets.include?(outlet_name) end def self.removed?(outlet_name) removed_outlets.include?(outlet_name) end def self.certified_outlets @certified_outlets ||= outlets_page.css('table.outlettable tr td:not(.removed) strong').map { |name| name.text.gsub(/[[:space:]]$/, '') } end def self.removed_outlets @removed_outlets ||= outlets_page.css('table.outlettable tr td.removed strong').map { |name| name.text.gsub(/[[:space:]]$/, '') } end private def self.outlets_page @outlets_page ||= Nokogiri::HTML(open(CERTIFIED_OUTLETS_URI)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hmc_outlets-0.0.0 | lib/hmc_outlets.rb |