module HtmlParser
Public Instance Methods
class_exists?(tag, file)
click to toggle source
# File lib/html_parser.rb, line 21 def class_exists? tag, file tag = tag.gsub('.', 'class') if tag.match(/^./) remove_extras(file).each do |line| if line.match(tag) return true end end end
id_exists?(tag, file)
click to toggle source
# File lib/html_parser.rb, line 12 def id_exists? tag, file tag = tag.gsub('#', 'id') remove_extras(file).each do |line| if line.match(tag) return true end end end
parent_exists?(tag, file)
click to toggle source
# File lib/html_parser.rb, line 30 def parent_exists? tag, file tag = tag.gsub('div.', 'class') if tag.match(/div/) remove_extras(file).each do |line| if line.match(tag) return true end end end
read_html(file)
click to toggle source
# File lib/html_parser.rb, line 4 def read_html file File.readlines(file) end
remove_extras(file)
click to toggle source
# File lib/html_parser.rb, line 8 def remove_extras file read_html(file).map {|line| line.delete(" <%>:=''\"\"")} end