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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7d70db570f43e185093f999f4463fd012c0c4a4f1de18d5650b4e2a138d5c3b
4
- data.tar.gz: 88cb21e69f2f9d6f2b36b52344011994e93769bc18e51cace0d7cd9b71dca6b8
3
+ metadata.gz: c36cee929807f94509cb288993f9397a15692e2864da29590e7203e49d5cecd6
4
+ data.tar.gz: daddb217445d0d89ac2c319d6243167fcd08d6c042566d31389837947992ffb2
5
5
  SHA512:
6
- metadata.gz: 5b6b2f69ff9c9a8faeded42dc79f74149a490a32bbfdb4273542c2e0d2d3ce897a037a913092235bf17fb4bfff82353036b0580eb9ce5f7ab93208a2cb889e29
7
- data.tar.gz: 83ca8d3b612f8a15866f5c6bb0c29b47e60610137192c1f4470a49850a276d899dc35d3ed20912e590e82f3e0eb3724f13c149f57800d6139b944ae1da64afbf
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: '^', eor: '~', 'property count': array.size.to_s, 'generated date': date }
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(header[:eor]).first.split(header[:eof]).map do |field|
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 : '|'", "EOR : '~'",
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('|')}~" }, '#END#']
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RightmoveBLM
4
- VERSION = '0.2.9'
4
+ VERSION = '0.2.10'
5
5
  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.9
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-08-05 00:00:00.000000000 Z
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.4.13
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: []