rightmove_blm 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rightmove_blm/document.rb +15 -7
- data/lib/rightmove_blm/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c36cee929807f94509cb288993f9397a15692e2864da29590e7203e49d5cecd6
|
4
|
+
data.tar.gz: daddb217445d0d89ac2c319d6243167fcd08d6c042566d31389837947992ffb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f66e75f7d997d70f1212584ebaf531d35027e61add06d57df3684157de0284993ba33ed93a9f8014ce0d6c3bb762bcbce8f037f1066c6d8903a011c4bf9b3c71
|
7
|
+
data.tar.gz: c5322e77e44c19ee6d070042917ea07afd5808902773cf3f52e88df7262ed079ff68b4a1a88dcd6b1b38077fd48a833d43043df3d4d115e41b2392a6b4c17db3
|
@@ -5,10 +5,10 @@ module RightmoveBLM
|
|
5
5
|
class Document # rubocop:disable Metrics/ClassLength
|
6
6
|
BLM_FILE_SECTIONS = %w[HEADER DEFINITION DATA END].freeze
|
7
7
|
|
8
|
-
def self.from_array_of_hashes(array, international: false)
|
8
|
+
def self.from_array_of_hashes(array, international: false, eor: '~', eof: '^')
|
9
9
|
date = Time.now.utc.strftime('%d-%b-%Y %H:%M').upcase
|
10
10
|
version = international ? '3i' : '3'
|
11
|
-
header = { version: version, eof:
|
11
|
+
header = { version: version, eof: eof, eor: eor, 'property count': array.size.to_s, 'generated date': date }
|
12
12
|
new(header: header, definition: array.first.keys.map(&:to_sym), data: array)
|
13
13
|
end
|
14
14
|
|
@@ -55,7 +55,7 @@ module RightmoveBLM
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def definition
|
58
|
-
@definition ||= contents(:definition).split(
|
58
|
+
@definition ||= contents(:definition).split(eor).first.split(eof).map do |field|
|
59
59
|
next nil if field.empty?
|
60
60
|
|
61
61
|
field.downcase.strip
|
@@ -130,20 +130,28 @@ module RightmoveBLM
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def header_string
|
133
|
-
['#HEADER#', "VERSION : #{header[:version]}", "EOF : '
|
133
|
+
['#HEADER#', "VERSION : #{header[:version]}", "EOF : '#{eof}'", "EOR : '#{eor}'",
|
134
134
|
"Property Count : #{data.size}", "Generated Date : #{generated_date}", '']
|
135
135
|
end
|
136
136
|
|
137
137
|
def definition_string
|
138
|
-
['#DEFINITION#', "#{definition.join(
|
138
|
+
['#DEFINITION#', "#{definition.join(eof)}#{eof}#{eor}", '']
|
139
139
|
end
|
140
140
|
|
141
141
|
def data_string
|
142
|
-
['#DATA#', *data.map { |row| "#{row.attributes.values.join(
|
142
|
+
['#DATA#', *data.map { |row| "#{row.attributes.values.join(eof)}#{eor}" }, '#END#']
|
143
143
|
end
|
144
144
|
|
145
145
|
def raise_parser_error(message, cause = nil)
|
146
146
|
raise ParserError, "#{inspect(safe: true)}: #{message} #{cause}"
|
147
147
|
end
|
148
|
+
|
149
|
+
def eor
|
150
|
+
header[:eor]
|
151
|
+
end
|
152
|
+
|
153
|
+
def eof
|
154
|
+
header[:eof]
|
155
|
+
end
|
148
156
|
end
|
149
|
-
end
|
157
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rightmove_blm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Parse and generate Rightmove BLM files
|
14
14
|
email: git@bob.frl
|
@@ -37,7 +37,7 @@ licenses:
|
|
37
37
|
- MIT
|
38
38
|
metadata:
|
39
39
|
rubygems_mfa_required: 'true'
|
40
|
-
post_install_message:
|
40
|
+
post_install_message:
|
41
41
|
rdoc_options: []
|
42
42
|
require_paths:
|
43
43
|
- lib
|
@@ -52,8 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
rubygems_version: 3.
|
56
|
-
signing_key:
|
55
|
+
rubygems_version: 3.1.6
|
56
|
+
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: A parser for the Rightmove .blm format
|
59
59
|
test_files: []
|