class Topic

Attributes

name[RW]
portals[RW]

Public Class Methods

all() click to toggle source
# File lib/topic.rb, line 22
def self.all
  @@all
end
find_or_create_by_name(name) click to toggle source
# File lib/topic.rb, line 26
def self.find_or_create_by_name(name)
  if self.all.detect{|topic| topic.name == name}
    @topic = self.all.detect{|topic| topic.name == name}
  else
    @topic = self.new(name)
  end
  @topic
end
new(name) click to toggle source
# File lib/topic.rb, line 5
def initialize(name)
  @name = name
  @portals = []
  # add_portal
  @@all << self
end

Public Instance Methods

find_random_portal_page() click to toggle source
# File lib/topic.rb, line 12
def find_random_portal_page
  find_rand_portal = Scraper.scrape_portals_page(@name).sample
  # create_portal = Portal.find_rand_portal
  # return create_portal
end