Class: Sirius::Thread

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sirius/thread.rb

Overview

All threads from request maps on this class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Thread

Get Hash=> “10” … and generate attributes



13
14
15
16
17
# File 'lib/sirius/thread.rb', line 13

def initialize(json)
  json.each do |key, value|
    self.send("#{key}=", value)
  end
end

Instance Attribute Details

#boardObject

Returns the value of attribute board.



9
10
11
# File 'lib/sirius/thread.rb', line 9

def board
  @board
end

#image_countObject

Returns the value of attribute image_count.



9
10
11
# File 'lib/sirius/thread.rb', line 9

def image_count
  @image_count
end

#omitObject

Returns the value of attribute omit.



9
10
11
# File 'lib/sirius/thread.rb', line 9

def omit
  @omit
end

#omitimagesObject

Returns the value of attribute omitimages.



9
10
11
# File 'lib/sirius/thread.rb', line 9

def omitimages
  @omitimages
end

#postsObject

Returns the value of attribute posts.



9
10
11
# File 'lib/sirius/thread.rb', line 9

def posts
  @posts
end

#reply_countObject

Returns the value of attribute reply_count.



9
10
11
# File 'lib/sirius/thread.rb', line 9

def reply_count
  @reply_count
end

Instance Method Details

#each(&block) ⇒ Object

:nodoc:



48
49
50
# File 'lib/sirius/thread.rb', line 48

def each(&block) #:nodoc:
  posts.each(&block)
end

#loadObject Also known as: load!

Load thread

Summary

When you get all threads from page, you take only limit posts from thread, but with this method you can load all posts for thread.

Example

Api::PR::page.first.size # => 6 
# But with `load`
Api::PR::page.first.load.size # => 100


38
39
40
# File 'lib/sirius/thread.rb', line 38

def load
  Api::thread(board, posts.first.num)
end