Class: NogizakaBlog::Amazing
- Inherits:
-
Object
- Object
- NogizakaBlog::Amazing
- Includes:
- Enumerable
- Defined in:
- lib/nogizaka_blog/amazing.rb
Instance Attribute Summary collapse
-
#member_size ⇒ Object
readonly
Returns the value of attribute member_size.
-
#yearmonth ⇒ Object
Returns the value of attribute yearmonth.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(yearmonth) ⇒ Amazing
constructor
A new instance of Amazing.
- #scraping(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#member_size ⇒ Object (readonly)
Returns the value of attribute member_size.
10 11 12 |
# File 'lib/nogizaka_blog/amazing.rb', line 10 def member_size @member_size end |
#yearmonth ⇒ Object
Returns the value of attribute yearmonth.
11 12 13 |
# File 'lib/nogizaka_blog/amazing.rb', line 11 def yearmonth @yearmonth end |
Instance Method Details
#each ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/nogizaka_blog/amazing.rb', line 23 def each MEMBER.keys.each do |name| max = max_page(name) @comment = [] # @comment = 0 when redirected if max == -1 @comment << 0 elsif max == 0 url = "http://blog.nogizaka46.com/#{name}/?d=#{@yearmonth}" comment_size(url) else (1..max).each do |n| url = "http://blog.nogizaka46.com/#{name}/?p=#{n}&d=#{@yearmonth}" comment_size(url) end end if max == -1 article = 0 else article = @comment.length end yield name, @comment.sum, article end end |
#scraping(&block) ⇒ Object
18 19 20 21 |
# File 'lib/nogizaka_blog/amazing.rb', line 18 def scraping(&block) warn "\e[31m[DEPRECATION] `scraping` is deprecated. Please use `each` instead.\e[0m" each(&block) end |