doko 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/doko.gemspec +1 -1
- data/lib/doko.rb +6 -2
- data/spec/doko_spec.rb +5 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/doko.gemspec
CHANGED
data/lib/doko.rb
CHANGED
@@ -14,11 +14,15 @@ class Doko
|
|
14
14
|
if str.match( /^#{URI.regexp}$/ )
|
15
15
|
str = open(str).read
|
16
16
|
end
|
17
|
-
|
17
|
+
if str.match(/<html/)
|
18
|
+
@text = (Nokogiri::HTML(str)/"body").text
|
19
|
+
else
|
20
|
+
@text = str
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def parse
|
21
|
-
body =
|
25
|
+
body = @text
|
22
26
|
body.tr!("0-9","0-9")
|
23
27
|
body.tr!("ー","-")
|
24
28
|
body.tr!("()","()")
|
data/spec/doko_spec.rb
CHANGED
@@ -5,7 +5,11 @@ require 'open-uri'
|
|
5
5
|
|
6
6
|
describe "Doko" do
|
7
7
|
|
8
|
-
it "should
|
8
|
+
it "should retrieve address from string" do
|
9
|
+
Doko.parse("ここは\n東京都港区芝浦3-4-1\nです").first.should == "東京都港区芝浦3-4-1"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should retrieve address from html" do
|
9
13
|
addrs = Doko.parse(open("http://r.tabelog.com/tokyo/A1304/A130401/13130066/").read)
|
10
14
|
addrs.first.should == "東京都新宿区新宿3-38-1 ルミネエスト7F"
|
11
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
segments:
|
144
144
|
- 0
|
145
|
-
hash:
|
145
|
+
hash: -3009257720424564000
|
146
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
147
|
none: false
|
148
148
|
requirements:
|