Class: TildeScraper::Page

Inherits:
Object
  • Object
show all
Extended by:
Memorable::ClassMethods
Includes:
Memorable::InstanceMethods
Defined in:
lib/tilde_scraper/page.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Memorable::ClassMethods

create, create_from_array

Methods included from Memorable::InstanceMethods

#add_attributes

Constructor Details

#initialize(attributes) ⇒ Page

Returns a new instance of Page.



13
14
15
16
# File 'lib/tilde_scraper/page.rb', line 13

def initialize(attributes)
  super(attributes)
  get_query
end

Instance Attribute Details

#groupObject

Returns the value of attribute group.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def group
  @group
end

Returns the value of attribute next_link.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def next_link
  @next_link
end

#orderObject

Returns the value of attribute order.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def order
  @order
end

#page_idObject

Returns the value of attribute page_id.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def page_id
  @page_id
end

#periodObject

Returns the value of attribute period.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def period
  @period
end

Returns the value of attribute prev_link.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def prev_link
  @prev_link
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/tilde_scraper/page.rb', line 2

def url
  @url
end

Class Method Details

.allObject



9
10
11
# File 'lib/tilde_scraper/page.rb', line 9

def self.all
  @@all
end

Instance Method Details

#displayObject



22
23
24
25
26
27
28
# File 'lib/tilde_scraper/page.rb', line 22

def display
  topics.each.with_index(1) do |topic, index|
    puts "#{index}. #{topic.type}post"
    topic.display
    puts ""
  end
end

#topicsObject



18
19
20
# File 'lib/tilde_scraper/page.rb', line 18

def topics
  TildeScraper::Topic.find_by_page_id(page_id)
end