nogizaka_blog 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c131db3635b1c565290f74ea29b52a75b5317244
4
- data.tar.gz: 8f8600d6d45a9ca285405fb4e9b3e2c79a47e2df
3
+ metadata.gz: 973ac557cb48d5056fa14f8b49f276706c5fcff4
4
+ data.tar.gz: eebda70f666a82d4ebd2bfe2e381e3046896a3fd
5
5
  SHA512:
6
- metadata.gz: d163a224fce25b46bad84866a0f1f7a74ecb95cc2a993a75af9ca2db0decb7f65c92bb30b53c973e9515a2e495f022d5fdb19bf8650bb0b10b459053c24c191d
7
- data.tar.gz: 71c8995f8fcf39261de24f8f42c247f05b9dd5587827c1a720062c5c351443214dbe3afc8f75e1dee0bbaedde4a0d11b0b068760c1b1f0e19c6f16c975cca9c2
6
+ metadata.gz: b8d64778115d10557ababf94f4c5f59d149295e68134481dbbb3a50668984b194c7064c3dfd55cdcb854eb0c51d63c5a3878d8cef437140098d2b98d67cdeb5f
7
+ data.tar.gz: ef52a6e4896ef82f78c20ce9a01a2ac74b6c627f5d117ad0962fab22e9b68df39bf536357254c241bda49222f36ec3c1a83cd38e67fdd72dfbffe71bbb2df49d
data/README.md CHANGED
@@ -22,10 +22,10 @@ Or install it yourself as:
22
22
  require 'nogizaka_blog'
23
23
 
24
24
 
25
- nogi = NogizakaBlog::Amazing.new('201405')
25
+ nogi = NogizakaBlog::Amazing.new('201508')
26
26
 
27
- nogi.scraping do |name, comment, article, index|
28
- puts "#{index} #{name.to_kanji}(#{name}) #{comment} / #{article}"
27
+ nogi.each do |name, comment, article|
28
+ puts "#{name.to_kanji}(#{name}) #{comment} / #{article}"
29
29
  end
30
30
  ```
31
31
 
@@ -34,14 +34,14 @@ Generate JSON example
34
34
  ```ruby
35
35
  require 'nogizaka_blog'
36
36
 
37
- @nogi = NogizakaBlog::Amazing.new('201405')
37
+ @nogi = NogizakaBlog::Amazing.new('201508')
38
38
 
39
39
  p @nogi.member_size
40
40
 
41
41
  def gen_json
42
42
  last = @nogi.member_size - 1
43
43
  print '['
44
- @nogi.scraping do |name, comment, article, idx|
44
+ @nogi.each_with_index do |(name, comment, article), idx|
45
45
  if idx == last
46
46
  print %Q({"name": "#{name.to_kanji}", "comment": #{comment}, "article": #{article}})
47
47
  else
@@ -4,6 +4,7 @@ require 'net/http'
4
4
 
5
5
  module NogizakaBlog
6
6
  class Amazing
7
+ include Enumerable
7
8
  using Extensions if RUBY_VERSION >= '2.1.0'
8
9
 
9
10
  attr_reader :member_size
@@ -14,9 +15,14 @@ module NogizakaBlog
14
15
  @member_size = MEMBER.size
15
16
  end
16
17
 
17
- def scraping
18
+ def scraping(&block)
19
+ warn "\e[31m[DEPRECATION] `scraping` is deprecated. Please use `each` instead.\e[0m"
20
+ each(&block)
21
+ end
22
+
23
+ def each
18
24
  max_page
19
- @member_max.each_with_index do |(name, max), idx|
25
+ @member_max.each do |name, max|
20
26
  @comment = []
21
27
 
22
28
  # @comment = 0 when redirected
@@ -38,7 +44,7 @@ module NogizakaBlog
38
44
  article = @comment.length
39
45
  end
40
46
 
41
- yield name, @comment.sum, article, idx
47
+ yield name, @comment.sum, article
42
48
  end
43
49
  end
44
50
 
@@ -1,3 +1,3 @@
1
1
  module NogizakaBlog
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -1,6 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe NogizakaBlog do
4
+ describe 'Instance' do
5
+ it do
6
+ nogi = NogizakaBlog::Amazing.new(201508)
7
+ expect(nogi).to be_a(Enumerable)
8
+ end
9
+ end
10
+
4
11
  describe 'Extensions to String' do
5
12
  it 'to_kanji' do
6
13
  expect('manatsu.akimoto'.to_kanji).to eq('秋元真夏')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nogizaka_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - hachy