Class: WikihowTechTopics::WikihowTechTopicModel

Inherits:
Object
  • Object
show all
Defined in:
lib/wikihow_tech_topics/wikihow_tech_topic_model.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title = nil, content = nil) ⇒ WikihowTechTopicModel

Returns a new instance of WikihowTechTopicModel.



12
13
14
15
16
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 12

def initialize(title = nil, content = nil)
    @title = title
    @content = content
    @@all << self
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 7

def content
  @content
end

#content_arrayObject (readonly)

Returns the value of attribute content_array.



8
9
10
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 8

def content_array
  @content_array
end

#home_pageObject (readonly)

Returns the value of attribute home_page.



8
9
10
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 8

def home_page
  @home_page
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 7

def title
  @title
end

#title_arrayObject (readonly)

Returns the value of attribute title_array.



8
9
10
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 8

def title_array
  @title_array
end

Class Method Details

.allObject



34
35
36
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 34

def self.all
    @@all
end

.content_from_content_arrayObject



25
26
27
28
29
30
31
32
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 25

def self.content_from_content_array
    content_array = WikihowTechTopics::Scraper.scraped_content_array
    title_array.each do |title|
        @title.content = WikihowTechTopics::WikihowTechTopicModel.new
        binding.pry
        # self.new(title)
    end
end

.titles_from_title_arrayObject



18
19
20
21
22
23
# File 'lib/wikihow_tech_topics/wikihow_tech_topic_model.rb', line 18

def self.titles_from_title_array
    title_array = WikihowTechTopics::Scraper.scraped_title_array
    title_array.each do |title|
        self.new(title)
    end
end