scrapework 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/scrapework/object.rb +9 -1
- data/lib/scrapework/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f336f4f54a21300073ef37bceb8ff10e11aaf7fee1125875fd87c25cfe085391
|
4
|
+
data.tar.gz: e05f928bdb4913bef855b148cc086aace63589f5937b492753b942ea66e3888f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3186223db89443cae6070266ce236165943d0f8290d254fd6ac66ea6a497cc9f29c5850ef2f1d20a6c47587e401322ecf74c311dd8ca9d51aa050e4c4c3bac7f
|
7
|
+
data.tar.gz: 3d6b80b3e22c466bdacdd942bbb713f28cede625c2693b9ba3ca6867fd4f7d48f9e8069f66a7375ae970645480d25085da2fe4122f84aa515973cf9cc394c650
|
data/CHANGELOG.md
CHANGED
data/lib/scrapework/object.rb
CHANGED
@@ -7,6 +7,7 @@ require 'active_support/all'
|
|
7
7
|
|
8
8
|
module Scrapework
|
9
9
|
# Base class for web data type
|
10
|
+
# rubocop:disable Metrics/ClassLength
|
10
11
|
class Object
|
11
12
|
include ActiveAttr::Model
|
12
13
|
|
@@ -17,6 +18,7 @@ module Scrapework
|
|
17
18
|
end
|
18
19
|
|
19
20
|
# rubocop:disable Metrics/MethodLength
|
21
|
+
# rubocop:disable Metrics/AbcSize
|
20
22
|
def self.belongs_to(object, options = {})
|
21
23
|
ivar = "@#{object}"
|
22
24
|
mapped_method = "_mapped_#{object}"
|
@@ -36,6 +38,7 @@ module Scrapework
|
|
36
38
|
|
37
39
|
reflections[object] = { type: 'belongs_to', class: reflection_class }
|
38
40
|
end
|
41
|
+
# rubocop:enable Metrics/AbcSize
|
39
42
|
# rubocop:enable Metrics/MethodLength
|
40
43
|
|
41
44
|
# rubocop:disable Naming/PredicateName
|
@@ -101,6 +104,8 @@ module Scrapework
|
|
101
104
|
# rubocop:enable Metrics/MethodLength
|
102
105
|
# rubocop:enable Metrics/AbcSize
|
103
106
|
|
107
|
+
# rubocop:disable Metrics/AbcSize
|
108
|
+
# rubocop:disable Metrics/MethodLength
|
104
109
|
def self.paginate(&block)
|
105
110
|
mapped_method = :_pagination
|
106
111
|
|
@@ -118,6 +123,8 @@ module Scrapework
|
|
118
123
|
self.class.new(pages[1]) if pages[1]
|
119
124
|
end
|
120
125
|
end
|
126
|
+
# rubocop:enable Metrics/MethodLength
|
127
|
+
# rubocop:enable Metrics/AbcSize
|
121
128
|
|
122
129
|
def self.map(name, &block)
|
123
130
|
mapped_method = :"_mapped_#{name}"
|
@@ -126,7 +133,7 @@ module Scrapework
|
|
126
133
|
value = begin
|
127
134
|
instance_exec(_document, &block)
|
128
135
|
rescue StandardError => e
|
129
|
-
raise MappingError, e.message
|
136
|
+
raise MappingError, "failed to scrape `#{name}`: #{e.message}"
|
130
137
|
end
|
131
138
|
|
132
139
|
public_send("#{name}=", value)
|
@@ -156,3 +163,4 @@ module Scrapework
|
|
156
163
|
end
|
157
164
|
end
|
158
165
|
end
|
166
|
+
# rubocop:enable Metrics/ClassLength
|
data/lib/scrapework/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrapework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jphager2
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|