class Wikihow::Category
Attributes
title[RW]
topics[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/wikihow/category.rb, line 15 def self.all @@all end
get_or_create_categories()
click to toggle source
# File lib/wikihow/category.rb, line 19 def self.get_or_create_categories if self.all == [] Wikihow::Scraper.scrape_for_categories.each{|category| self.new(category)} end self.all end
new(category_hash)
click to toggle source
# File lib/wikihow/category.rb, line 4 def initialize(category_hash) self.title = category_hash[:title] self.url = category_hash[:url] self.topics = [] self.class.all << self end
Public Instance Methods
add_topic(topic)
click to toggle source
# File lib/wikihow/category.rb, line 11 def add_topic(topic) self.topics << topic end