Class: Sirius::Thread
- Inherits:
-
Object
- Object
- Sirius::Thread
- Includes:
- Enumerable
- Defined in:
- lib/sirius/thread.rb
Overview
All threads from request maps on this class
Instance Attribute Summary collapse
-
#board ⇒ Object
Returns the value of attribute board.
-
#image_count ⇒ Object
Returns the value of attribute image_count.
-
#omit ⇒ Object
Returns the value of attribute omit.
-
#omitimages ⇒ Object
Returns the value of attribute omitimages.
-
#posts ⇒ Object
Returns the value of attribute posts.
-
#reply_count ⇒ Object
Returns the value of attribute reply_count.
Instance Method Summary collapse
-
#each(&block) ⇒ Object
:nodoc:.
-
#initialize(json) ⇒ Thread
constructor
Get Hash=> “10” … and generate attributes.
-
#load ⇒ Object
(also: #load!)
Load thread.
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
#board ⇒ Object
Returns the value of attribute board.
9 10 11 |
# File 'lib/sirius/thread.rb', line 9 def board @board end |
#image_count ⇒ Object
Returns the value of attribute image_count.
9 10 11 |
# File 'lib/sirius/thread.rb', line 9 def image_count @image_count end |
#omit ⇒ Object
Returns the value of attribute omit.
9 10 11 |
# File 'lib/sirius/thread.rb', line 9 def omit @omit end |
#omitimages ⇒ Object
Returns the value of attribute omitimages.
9 10 11 |
# File 'lib/sirius/thread.rb', line 9 def omitimages @omitimages end |
#posts ⇒ Object
Returns the value of attribute posts.
9 10 11 |
# File 'lib/sirius/thread.rb', line 9 def posts @posts end |
#reply_count ⇒ Object
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 |
#load ⇒ Object 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 |