removed redundant tests, added test for parsing from a file

This commit is contained in:
Shane Becker 2011-06-15 11:54:15 -07:00
parent f6fc30c489
commit f108aac104
2 changed files with 20 additions and 15 deletions

View file

@ -5,8 +5,11 @@ require 'date'
module Microformats2
VERSION = "1.0.0"
class LoadError < StandardError; end
def self.parse(html)
raise LoadError unless [String, File].include?(html.class)
raise LoadError, "argument must be a String or File" unless [String, File].include?(html.class)
doc = Nokogiri::HTML(html)
microformats = Hash.new{|hash, key| hash[key] = Array.new}
doc.css("*[class^=h-]").each do |microformat|
@ -132,8 +135,6 @@ module Microformats2
end
end
class LoadError < StandardError; end
# Thank you Rails Developers for your unitentional contribution to this project
# File activesupport/lib/active_support/inflector/inflections.rb, line 206
def self.classify(str)