aixm 0.3.10 → 0.3.11

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: e3f6bbccc417b5489c0406281f074c0e2ba763681f2ba93eecce13fc4512a5a3
4
- data.tar.gz: 2ee3415fd70d683ed60911ddb78f3cd2fa2277aaeea5546cb3e22ab1c22b2d73
3
+ metadata.gz: d86771a98ab156be9da1487e7e2e11615bcd63590824108717a51f07c044e241
4
+ data.tar.gz: b6fc6d7c2803169145153d434f1675f161be6ae731b54eb1d53b6d2fbcf4807b
5
5
  SHA512:
6
- metadata.gz: c8105e111e3ee60f5ad28b99a2beccd05ce719297c9bb836cca7742dc4b6dec6187fd3cc32b2f09d3924deea35e863329350ca02db869079a2a0f0855a60a6d5
7
- data.tar.gz: 5d620f1fb1d47d8a8e6f542029bba5e29d31db796baa6dba3c418d8aef0a6dd75e8996c95d68fa5f45187aae66119bf765af9ebc9d304c8179287c1bb395927c
6
+ metadata.gz: e537adc538ba520a2f0e891da01ccb13e768a5e183c8a042fbe3bf55f63bfc9f2a66125cf6a19b1882e7d646d8c9b0f848fc551f095a24323f24216d9a8036a1
7
+ data.tar.gz: 5a3884e00a329f243835648bce2bc13f1cd0ae701113dc89a86f23e83ebe9a82abf4af7a5c6aa87a8f22b1d7c49bc94fd222b2752a5a9bef42276936def12e60
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- ��*; ^ь�G�`��ِ .�%o+�����Z�P[~fRs��O7�ߘn(�8�.Yg����9EV��&Et���ט�97��0�`�ɨ���lxtl����_;���ٮaEO��@V��g���|H�n�lb7�J���'����Ui4%@J"�(_�ذ���#
1
+ ���W۰��.�},�G������s��o����ros��9J�
data/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
+ ## 0.3.11
2
+
3
+ #### Breaking Changes
4
+ * Renamed default git branch to `main`
5
+ * Require Ruby 3.0
6
+ * `Address#address` requires and returns `AIXM::F` for type `:radio_frequency`
7
+
8
+ #### Changes
9
+ * Fix `Obstacle#source` for OFMX
10
+
11
+ #### Additions
12
+ * Add `f#voice?` and `AIXM.config.voice_channel_separation` to check whether a
13
+ frequency belongs to the voice communication airband and use it to validate
14
+ `AIXM::Frequency`
15
+
1
16
  ## 0.3.10
2
17
 
3
- ### Additions
18
+ #### Additions
4
19
  * Proper `has_many` and `has_one` associations
5
20
  * `AIXM::Association:Array#find_by|find|duplicate` on `has_many` associations
6
21
  * `AIXM.config.mid` now defines whether `mid` attributes are inserted or not
@@ -12,7 +27,7 @@
12
27
  * `AIXM::Component::Geometry#point?|circle?|polygon?`
13
28
  * `AIXM::Component::Layer#services`
14
29
 
15
- ### Breaking Changes
30
+ #### Breaking Changes
16
31
  * Require Ruby 2.7
17
32
  * Moved `region` attribute from `Document` back to features again
18
33
  * Use `Document#add_feature` instead of `Document@features#<<`
@@ -25,7 +40,7 @@
25
40
  * Refinement `String#payload_hash` removed in favor of `AIXM::PayloadHash` class
26
41
  * Refinements `Array#find|duplicates` removed
27
42
 
28
- ### Changes
43
+ #### Changes
29
44
  * Renamed `AIXM.config.mid_region` to `AIXM.config.region`
30
45
 
31
46
  ## 0.3.8
data/README.md CHANGED
@@ -20,7 +20,7 @@ For now, only the parts needed to automize the AIP import of [open flightmaps](h
20
20
  This gem is [cryptographically signed](https://guides.rubygems.org/security/#using-gems) in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:
21
21
 
22
22
  ```
23
- gem cert --add <(curl -Ls https://raw.github.com/svoop/aixm/master/certs/svoop.pem)
23
+ gem cert --add <(curl -Ls https://raw.github.com/svoop/aixm/main/certs/svoop.pem)
24
24
  ```
25
25
 
26
26
  ### Bundler
@@ -100,19 +100,29 @@ The `:ofmx` schema requires the [region to be set on all core features](https://
100
100
 
101
101
  ```ruby
102
102
  AIXM.ofmx!
103
- AIXM.region = 'LF'
103
+ AIXM.config.region = 'LF'
104
104
  ```
105
105
 
106
106
  :warning: This setting has no effect when using the `:aixm` schema.
107
107
 
108
+ ### AIXM.voice_channel_separation
109
+
110
+ Define which voice channel separation should be used to validate voice communication frequencies.
111
+
112
+ ```ruby
113
+ AIXM.voice_channel_separation = :any # both 25 and 8.33 kHz (default)
114
+ AIXM.voice_channel_separation = 25 # 25 kHz only
115
+ AIXM.voice_channel_separation = 833 # 8.33 kHz only
116
+ ```
117
+
108
118
  ### AIXM.config.mid
109
119
 
110
120
  In order to insert [OFMX-compliant `mid` attributes](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid) into all `*Uid` elements, you have set the mid configuration option to `true`.
111
121
 
112
122
  ```ruby
113
123
  AIXM.ofmx!
114
- AIXM.config.mid # => false - don't insert mid attributes by default
115
- AIXM.config.mid = true # => true - insert mid attributes
124
+ AIXM.config.mid = false # don't insert mid attributes (default)
125
+ AIXM.config.mid = true # insert mid attributes
116
126
  ```
117
127
 
118
128
  :warning: This setting has no effect when using the `:aixm` schema.
data/exe/ckmid CHANGED
@@ -1,13 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # TODO: hide deprecations unless in gem root until fully complying with Ruby 2.7
4
- Warning[:deprecated] = Dir.pwd.match? /aixm$/
5
-
6
3
  require 'bundler/inline'
7
4
 
8
5
  gemfile do
9
6
  source 'https://rubygems.org'
10
- ruby '>= 2.7'
7
+ ruby '>= 3.0'
11
8
  gem 'aixm', '~> 0'
12
9
  end
13
10
 
data/exe/mkmid CHANGED
@@ -1,13 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # TODO: hide deprecations unless in gem root until fully complying with Ruby 2.7
4
- Warning[:deprecated] = Dir.pwd.match? /aixm$/
5
-
6
3
  require 'bundler/inline'
7
4
 
8
5
  gemfile do
9
6
  source 'https://rubygems.org'
10
- ruby '>= 2.7'
7
+ ruby '>= 3.0'
11
8
  gem 'aixm', '~> 0'
12
9
  end
13
10
 
@@ -187,7 +187,7 @@ module AIXM
187
187
  add_block.call(object) if add_block
188
188
  end
189
189
  instance_exec(object, **options, &association_block) if association_block
190
- fail(ArgumentError, "#{object.__class__} not allowed") unless class_names.reduce(false){ |m, c| m || object.is_a?(c.to_class) }
190
+ fail(ArgumentError, "#{object.__class__} not allowed") unless class_names.any? { |c| object.is_a?(c.to_class) }
191
191
  send(attribute).send(:push, object)
192
192
  object.instance_variable_set(:"@#{inversion}", self)
193
193
  self
@@ -220,7 +220,7 @@ module AIXM
220
220
  attr_reader attribute
221
221
  # feature= / add_feature
222
222
  define_method(:"#{association}=") do |object|
223
- fail(ArgumentError, "#{object.__class__} not allowed") unless class_names.reduce(false){ |m, c| m || object.is_a?(c.to_class) }
223
+ fail(ArgumentError, "#{object.__class__} not allowed") unless class_names.any? { |c| object.is_a?(c.to_class) }
224
224
  instance_variable_get(:"@#{attribute}")&.instance_variable_set(:"@#{inversion}", nil)
225
225
  instance_variable_set(:"@#{attribute}", object)
226
226
  object&.instance_variable_set(:"@#{inversion}", self)
@@ -298,9 +298,7 @@ module AIXM
298
298
  self.class.new(
299
299
  select do |element|
300
300
  if element.kind_of? klass
301
- attributes.reduce(true) do |memo, (attribute, value)|
302
- memo && element.send(attribute) == value
303
- end
301
+ attributes.all? { |a, v| element.send(a) == v }
304
302
  end
305
303
  end
306
304
  )
@@ -3,7 +3,7 @@ using AIXM::Refinements
3
3
  module AIXM
4
4
  module Component
5
5
 
6
- # Frequencies used by a service.
6
+ # Voice frequencies used by a service.
7
7
  #
8
8
  # By default, {#reception_f} is set to the same value as {#transmission_f}
9
9
  # since most services rely on simplex (aka: non-duplex) two-way
@@ -73,7 +73,7 @@ module AIXM
73
73
  end
74
74
 
75
75
  def transmission_f=(value)
76
- fail(ArgumentError, "invalid transmission_f") unless value.is_a? AIXM::F
76
+ fail(ArgumentError, "invalid transmission_f") unless value.is_a?(AIXM::F) && value.voice?
77
77
  @transmission_f = value
78
78
  end
79
79
 
@@ -83,7 +83,7 @@ module AIXM
83
83
  end
84
84
 
85
85
  def reception_f=(value)
86
- fail(ArgumentError, "invalid reception_f") unless value.nil? || value.is_a?(AIXM::F)
86
+ fail(ArgumentError, "invalid reception_f") unless value.nil? || value.is_a?(AIXM::F) && value.voice?
87
87
  @reception_f = value
88
88
  end
89
89
 
data/lib/aixm/config.rb CHANGED
@@ -78,6 +78,7 @@ module AIXM
78
78
  def initialize_config
79
79
  @@config = OpenStruct.new(
80
80
  schema: :aixm,
81
+ voice_channel_separation: :any,
81
82
  mid: false,
82
83
  inflector: Dry::Inflector.new
83
84
  )
data/lib/aixm/f.rb CHANGED
@@ -64,6 +64,34 @@ module AIXM
64
64
  to_s.hash
65
65
  end
66
66
 
67
+ # @return [Boolean] whether this frequency is part of the voice airband
68
+ # for civil aviation using `AIXM.config.voice_channel_separation`
69
+ def voice?
70
+ return false unless unit == :mhz
71
+ case AIXM.config.voice_channel_separation
72
+ when 25 then voice_25?
73
+ when 833 then voice_833?
74
+ when :any then voice_25? || voice_833?
75
+ else fail(ArgumentError, "unknown voice channel separation")
76
+ end
77
+ end
78
+
79
+ private
80
+
81
+ # @return [Boolean] whether this frequency is part of the voice airband
82
+ # for civil aviation using 25 kHz channel separation
83
+ def voice_25?
84
+ return false unless unit == :mhz && freq == freq.round(3) && freq.between?(118, 136.975)
85
+ ((freq * 1000).round % 25).zero?
86
+ end
87
+
88
+ # @return [Boolean] whether this frequency is part of the voice airband
89
+ # for civil aviation using 8.33 kHz channel separation
90
+ def voice_833?
91
+ return false unless unit == :mhz && freq == freq.round(3) && freq.between?(118, 136.99)
92
+ [0.005, 0.01, 0.015].any? { |d| (((freq - d) * 1000).round % 25).zero? }
93
+ end
94
+
67
95
  end
68
96
 
69
97
  end
@@ -9,7 +9,7 @@ module AIXM
9
9
  # address = AIXM.address(
10
10
  # source: String or nil
11
11
  # type: TYPES
12
- # address: String
12
+ # address: AIXM.f (type :radio_frequency) or String (other types)
13
13
  # )
14
14
  # service.remarks = String or nil
15
15
  #
@@ -64,8 +64,14 @@ module AIXM
64
64
  end
65
65
 
66
66
  def address=(value)
67
- fail(ArgumentError, "invalid address") unless value.is_a? String
68
- @address = value&.to_s
67
+ case type
68
+ when :radio_frequency
69
+ fail(ArgumentError, "invalid address frequency") unless value.is_a?(AIXM::F)
70
+ @address = value
71
+ else
72
+ fail(ArgumentError, "invalid address") unless value
73
+ @address = value.to_s
74
+ end
69
75
  end
70
76
 
71
77
  def remarks=(value)
@@ -130,7 +130,7 @@ module AIXM
130
130
 
131
131
  # @return [String]
132
132
  def inspect
133
- %Q(#<#{self.class} xy="#{xy.to_s}" type=#{type.inspect}>)
133
+ %Q(#<#{self.class} xy="#{xy.to_s}" type=#{type.inspect} name=#{name.inspect}>)
134
134
  end
135
135
 
136
136
  def name=(value)
@@ -238,7 +238,7 @@ module AIXM
238
238
  return obstacle_group.to_xml if delegate && obstacle_group && AIXM.ofmx?
239
239
  builder = Builder::XmlMarkup.new(indent: 2)
240
240
  builder.comment! "Obstacle: [#{type}] #{xy.to_s} #{name}".strip
241
- builder.Obs do |obs|
241
+ builder.Obs({ source: (source if AIXM.ofmx?) }.compact) do |obs|
242
242
  obs << to_uid.indent(2)
243
243
  obs << obstacle_group.to_uid.indent(2) if obstacle_group && AIXM.ofmx?
244
244
  obs.txtName(name) if name
@@ -4,8 +4,8 @@ module AIXM
4
4
 
5
5
  # Shortcut initializers
6
6
  CLASSES.each do |element, class_name|
7
- define_singleton_method(element) do |*arguments|
8
- class_name.to_class.new(*arguments)
7
+ define_singleton_method(element) do |*args, **kwargs|
8
+ class_name.to_class.new(*args, **kwargs)
9
9
  end
10
10
  end
11
11
 
data/lib/aixm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AIXM
2
- VERSION = "0.3.10".freeze
2
+ VERSION = "0.3.11".freeze
3
3
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,36 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aixm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQ0wCwYDVQQDDARydWJ5
14
14
  MRkwFwYKCZImiZPyLGQBGRYJYml0Y2V0ZXJhMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTIwMDMxNDE5NDgwNVoXDTIxMDMxNDE5NDgwNVowPzENMAsGA1UEAwwEcnVi
15
+ MB4XDTIxMTEwODE0MzIyM1oXDTIyMTEwODE0MzIyM1owPzENMAsGA1UEAwwEcnVi
16
16
  eTEZMBcGCgmSJomT8ixkARkWCWJpdGNldGVyYTETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL4k2DCa8/eAFiak4Kwe
18
- 0Iu8dk0JfHWeywjVVSNv6PtnQ96B/1jLmw5Wb+xYJSyvG6KEOzEMWA/lqO+nIrdO
19
- 2LDRxuWojH5GROp/dtQ+SxsWlvui4cs9iBmI5Mj0mc1UgST3UFf60ry8OnyR+E9N
20
- RVVZZykAGmxwyAqD1aq5Yt0lZMdvrGnaLWcZdKC99e812pdTN948k8Iw2GJAaNtH
21
- Tp17XDfDNBANHjYy9xCqrxvNTfT4Bs43rPA1A77+mkPgI2Vx51u2CWA+K3hP4gAZ
22
- F50xqnagzgXSOzCme1mC/sUUmoAAB39g2CuNocWuhv0R3/HeqdwAsA/1XpDF2NfQ
23
- zW8CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFDfY
24
- gRWUI+J6nX7Po7Zq0zvDopfYMB0GA1UdEQQWMBSBEnJ1YnlAYml0Y2V0ZXJhLmNv
17
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANwuD4geNdhpSVNJTtHb
18
+ fmVAoPxmER4oyGga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3MJEyzdeUh7N+UMKuPps/flPgH5yabUxgxrvuhrXF7Z96nrsP
29
+ EOmNMTc8H7wo4BAKfuMcI/Gh2oCf+tAhr0bGsXyBikmJ6XA45mrOMgv19M1+aMpn
30
+ 1+2Y1+i+4jd1B7qxIgOLxQTNIJiwE0sqU1itFfuesfgUACS7M0IV9u9Bp4hBGNEw
31
+ 5JcY2h7owdMxXIvgk1oakgldFJc=
32
32
  -----END CERTIFICATE-----
33
- date: 2020-03-15 00:00:00.000000000 Z
33
+ date: 2021-11-08 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: builder
@@ -284,11 +284,11 @@ licenses:
284
284
  - MIT
285
285
  metadata:
286
286
  homepage_uri: https://github.com/svoop/aixm
287
- changelog_uri: https://github.com/svoop/aixm/blob/master/CHANGELOG.md
287
+ changelog_uri: https://github.com/svoop/aixm/blob/main/CHANGELOG.md
288
288
  source_code_uri: https://github.com/svoop/aixm
289
289
  documentation_uri: https://www.rubydoc.info/gems/aixm
290
290
  bug_tracker_uri: https://github.com/svoop/aixm/issues
291
- post_install_message:
291
+ post_install_message:
292
292
  rdoc_options:
293
293
  - "--title"
294
294
  - AIXM/OFMX Builder
@@ -303,15 +303,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - ">="
305
305
  - !ruby/object:Gem::Version
306
- version: 2.7.0
306
+ version: 3.0.0
307
307
  required_rubygems_version: !ruby/object:Gem::Requirement
308
308
  requirements:
309
309
  - - ">="
310
310
  - !ruby/object:Gem::Version
311
311
  version: '0'
312
312
  requirements: []
313
- rubygems_version: 3.1.2
314
- signing_key:
313
+ rubygems_version: 3.2.30
314
+ signing_key:
315
315
  specification_version: 4
316
316
  summary: Builder for AIXM/OFMX aeronautical information
317
317
  test_files: []
metadata.gz.sig CHANGED
Binary file