bbs2ch 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -21
- data/bbs2ch.gemspec +2 -2
- data/lib/bbs2ch/board.rb +1 -1
- data/lib/bbs2ch/response.rb +7 -1
- data/lib/bbs2ch/thread.rb +2 -3
- data/lib/bbs2ch/version.rb +1 -1
- data/spec/bbs2ch_spec.rb +1 -2
- metadata +5 -5
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# BBB2ch
|
2
2
|
|
3
|
-
A gem to read 2ch
|
3
|
+
A gem to read 2ch BBS
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,25 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
menu = BBS2ch::Menu.new
|
24
|
-
|
25
|
-
# all boards on 2ch
|
26
|
-
all_boards = menu.boards
|
27
|
-
|
28
|
-
# or select with name(regex)
|
29
|
-
news_boards = menu.boards(/ニュース/)
|
30
|
-
|
31
|
-
|
32
|
-
# all threads on first news_board
|
33
|
-
threads = news_boards.first.threads
|
34
|
-
|
35
|
-
# or select with name(regex)
|
36
|
-
threads = news_boards.first.threads(/政治/)
|
37
|
-
|
38
|
-
# get responses on the thread
|
39
|
-
p threads.first.responses
|
21
|
+
<script src="https://gist.github.com/3122877.js?file=get_cat_images.rb"></script>
|
40
22
|
|
41
23
|
|
42
24
|
## Contributing
|
data/bbs2ch.gemspec
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/bbs2ch/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["fukayatsu"]
|
6
6
|
gem.email = ["fukayatsu@gmail.com"]
|
7
|
-
gem.description = %q{A gem to read 2ch
|
8
|
-
gem.summary = %q{A gem to read 2ch
|
7
|
+
gem.description = %q{A gem to read 2ch BBS}
|
8
|
+
gem.summary = %q{A gem to read 2ch BBS}
|
9
9
|
gem.homepage = ""
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
data/lib/bbs2ch/board.rb
CHANGED
data/lib/bbs2ch/response.rb
CHANGED
@@ -9,7 +9,7 @@ module BBS2ch
|
|
9
9
|
@time = time
|
10
10
|
@message = message
|
11
11
|
@extra = extra
|
12
|
-
@extra[
|
12
|
+
@extra[:response] =
|
13
13
|
{name: @name, email: @email, time: @time, message: @message}
|
14
14
|
end
|
15
15
|
|
@@ -26,6 +26,12 @@ module BBS2ch
|
|
26
26
|
images
|
27
27
|
end
|
28
28
|
|
29
|
+
# TODO arrayに対応
|
30
|
+
def self.parse(text, extra={})
|
31
|
+
name, email, time_str, message = text.chomp.split(/<>/)
|
32
|
+
Response.new(name, email, Time.parse(time_str), message, extra)
|
33
|
+
end
|
34
|
+
|
29
35
|
attr_reader :name, :email, :time, :message, :extra
|
30
36
|
end
|
31
37
|
end
|
data/lib/bbs2ch/thread.rb
CHANGED
@@ -8,7 +8,7 @@ module BBS2ch
|
|
8
8
|
@name = name
|
9
9
|
@url = url
|
10
10
|
@extra = extra
|
11
|
-
@extra[
|
11
|
+
@extra[:thread] = {name: @name, url: @url}
|
12
12
|
end
|
13
13
|
|
14
14
|
# TODO select, cache
|
@@ -19,8 +19,7 @@ module BBS2ch
|
|
19
19
|
|
20
20
|
responses = []
|
21
21
|
page.body.toutf8.lines{|line|
|
22
|
-
|
23
|
-
responses << Response.new(name, email, Time.parse(time_str), message, extra)
|
22
|
+
responses << Response.parse(line)
|
24
23
|
}
|
25
24
|
responses
|
26
25
|
end
|
data/lib/bbs2ch/version.rb
CHANGED
data/spec/bbs2ch_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe BBS2ch do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
context '#images' do
|
54
|
-
it '
|
54
|
+
it 'return 2 images' do
|
55
55
|
response = BBS2ch::Response.new('name', 'email', 'time', '
|
56
56
|
http://hoge.com/hoge/piyo.jpg<br>
|
57
57
|
ttp://hoge.com/hoge/piyo.png<br>')
|
@@ -67,5 +67,4 @@ describe BBS2ch do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbs2ch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
description: A gem to read 2ch
|
62
|
+
description: A gem to read 2ch BBS
|
63
63
|
email:
|
64
64
|
- fukayatsu@gmail.com
|
65
65
|
executables: []
|
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
segments:
|
97
97
|
- 0
|
98
|
-
hash:
|
98
|
+
hash: 3642638197611839710
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
none: false
|
101
101
|
requirements:
|
@@ -104,12 +104,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
segments:
|
106
106
|
- 0
|
107
|
-
hash:
|
107
|
+
hash: 3642638197611839710
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
110
|
rubygems_version: 1.8.24
|
111
111
|
signing_key:
|
112
112
|
specification_version: 3
|
113
|
-
summary: A gem to read 2ch
|
113
|
+
summary: A gem to read 2ch BBS
|
114
114
|
test_files:
|
115
115
|
- spec/bbs2ch_spec.rb
|