質問編集履歴
1
コードの不要部分の修正、格納する変数をoffice_detailにしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,15 +6,11 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
*新たに格納する変数はoffice_detailです。
|
9
10
|
|
10
11
|
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
```ruby
|
18
14
|
|
19
15
|
require "net/http"
|
20
16
|
|
@@ -36,10 +32,6 @@
|
|
36
32
|
|
37
33
|
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
35
|
response.code # status code
|
44
36
|
|
45
37
|
body = response.body # response body
|
@@ -48,7 +40,7 @@
|
|
48
40
|
|
49
41
|
p text.encoding
|
50
42
|
|
51
|
-
|
43
|
+
|
52
44
|
|
53
45
|
|
54
46
|
|
@@ -56,13 +48,7 @@
|
|
56
48
|
|
57
49
|
|
58
50
|
|
59
|
-
#tables = text.match(/<table(?: .+?)?>.*?</table>/)
|
60
|
-
|
61
51
|
tables = text.scan(/<table.*?</table>/)
|
62
|
-
|
63
|
-
#p tables.length
|
64
|
-
|
65
|
-
#p tables
|
66
52
|
|
67
53
|
|
68
54
|
|
@@ -70,19 +56,15 @@
|
|
70
56
|
|
71
57
|
tables.each do |tbl|
|
72
58
|
|
73
|
-
# tbl
|
74
|
-
|
75
59
|
ths = tbl.scan(/<th.*?</th>/)
|
76
60
|
|
77
|
-
|
61
|
+
ths.length
|
78
62
|
|
79
63
|
|
80
64
|
|
81
65
|
tds = tbl.scan(/<td.*?</td>/)
|
82
66
|
|
83
|
-
#p tds.length
|
84
67
|
|
85
|
-
#p tds
|
86
68
|
|
87
69
|
|
88
70
|
|
@@ -100,7 +82,7 @@
|
|
100
82
|
|
101
83
|
|
102
84
|
|
103
|
-
|
85
|
+
|
104
86
|
|
105
87
|
array_office.push(office)
|
106
88
|
|
@@ -108,9 +90,9 @@
|
|
108
90
|
|
109
91
|
end
|
110
92
|
|
93
|
+
```
|
111
94
|
|
112
95
|
|
113
|
-
p array_office
|
114
96
|
|
115
97
|
-----------------------------------
|
116
98
|
|