aixm 0.2.1 → 0.2.2

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: 486dafa5ec46b76f70a12053bdc29606c563136106cd25ffafc62906decec9e4
4
- data.tar.gz: f154584ca3cc854eec2e715b76ff379b689ed51a0bd7887979445b3733a3e0d6
3
+ metadata.gz: 273c3a151ac0b4c91488692c47918ba3ca36e044e4d1392ba48b98d2ad45f08e
4
+ data.tar.gz: 4dca28d512bd61ea981ea7e24889e6796b5eeab8ee950e7859bb4b6604848d50
5
5
  SHA512:
6
- metadata.gz: 68808eefa33113f2e57c5376156c5395711c80f447e9cb03584076d45f043b102f213450e6e2f438ec4a0480eff10708605c6bb623bcba2a55d629241a4d4a7a
7
- data.tar.gz: 148345f24a85d5e5636d93175ea516c1266bd5277f0a13c301acb8762155f349a80a095c33856b8ff8234826e3301409b73b7b8fb681ac872463a8d9e596e272
6
+ metadata.gz: 87471ca95b1590688987f08d7c40c910f63395cb2ab109947acd8be0d28ad704e4a7ff82facb3c510253349dc083de93866f91cc9f750472ef8782019f36a628
7
+ data.tar.gz: f1004c94f130cdb333863701746b20eaa23fd36e7ddabfc60c37ad156d49c1f30753663bdcc2a32a60cc8ff3d462f6ad8b23ec649d0d0a4be4d9e3a1bb322463
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.2
2
+
3
+ * Minor changes:
4
+ * Fix bad error classes
5
+ * Allow navigational aids without name
6
+
1
7
  ## 0.2.1
2
8
 
3
9
  * Major changes:
data/README.md CHANGED
@@ -107,7 +107,7 @@ airspace.remarks = String
107
107
  ```ruby
108
108
  designated_point = AIXM.designated_point(
109
109
  id: String
110
- name: String
110
+ name: String or nil
111
111
  xy: AIXM.xy
112
112
  z: AIXM.z or nil
113
113
  type: :icao or :adhp, or :coordinates
@@ -23,17 +23,17 @@ module AIXM
23
23
  end
24
24
 
25
25
  def name=(value)
26
- fail(AttributeError, "invalid name") unless value.is_a? String
26
+ fail(ArgumentError, "invalid name") unless value.is_a? String
27
27
  @name = value.uptrans
28
28
  end
29
29
 
30
30
  def short_name=(value)
31
- fail(AttributeError, "invalid short name") unless value.nil? || value.is_a?(String)
31
+ fail(ArgumentError, "invalid short name") unless value.nil? || value.is_a?(String)
32
32
  @short_name = value&.uptrans
33
33
  end
34
34
 
35
35
  def type=(value)
36
- fail(AttributeError, "invalid type") unless value.is_a?(String)
36
+ fail(ArgumentError, "invalid type") unless value.is_a?(String)
37
37
  @type = value.upcase
38
38
  end
39
39
 
@@ -43,7 +43,7 @@ module AIXM
43
43
  end
44
44
 
45
45
  def remarks=(value)
46
- fail(AttributeError, "invalid remarks") unless value.is_a?(String)
46
+ fail(ArgumentError, "invalid remarks") unless value.is_a?(String)
47
47
  @remarks = value
48
48
  end
49
49
 
@@ -13,7 +13,7 @@ module AIXM
13
13
 
14
14
  private_class_method :new
15
15
 
16
- def initialize(id:, name:, xy:, z: nil)
16
+ def initialize(id:, name: nil, xy:, z: nil)
17
17
  self.id, self.name, self.xy, self.z = id, name, xy, z
18
18
  end
19
19
 
@@ -23,8 +23,8 @@ module AIXM
23
23
  end
24
24
 
25
25
  def name=(value)
26
- fail(ArgumentError, "invalid name") unless value.is_a? String
27
- @name = value.upcase
26
+ fail(ArgumentError, "invalid name") unless value.nil? || value.is_a?(String)
27
+ @name = value&.upcase
28
28
  end
29
29
 
30
30
  def xy=(value)
@@ -23,7 +23,7 @@ module AIXM
23
23
 
24
24
  public_class_method :new
25
25
 
26
- def initialize(id:, name:, xy:, z: nil, type:)
26
+ def initialize(id:, name: nil, xy:, z: nil, type:)
27
27
  super(id: id, name: name, xy: xy, z: z)
28
28
  self.type = type
29
29
  end
@@ -60,7 +60,7 @@ module AIXM
60
60
  builder.Dpn do |dpn|
61
61
  dpn << to_uid(*extensions).indent(2)
62
62
  dpn.OrgUid
63
- dpn.txtName(name)
63
+ dpn.txtName(name) if name
64
64
  dpn.codeDatum('WGE')
65
65
  dpn.codeType(type_key.to_s)
66
66
  if z
@@ -54,7 +54,7 @@ module AIXM
54
54
  dme << to_uid(*extensions).indent(2)
55
55
  dme.OrgUid
56
56
  dme << vor.to_uid(*extensions).indent(2) if vor
57
- dme.txtName(name)
57
+ dme.txtName(name) if name
58
58
  dme.codeChannel(channel)
59
59
  dme.codeDatum('WGE')
60
60
  if z
@@ -37,7 +37,7 @@ module AIXM
37
37
  mkr.OrgUid
38
38
  mkr.valFreq(75)
39
39
  mkr.uomFreq('MHZ')
40
- mkr.txtName(name)
40
+ mkr.txtName(name) if name
41
41
  mkr.codeDatum('WGE')
42
42
  if z
43
43
  mkr.valElev(z.alt)
@@ -48,7 +48,7 @@ module AIXM
48
48
  builder.Ndb do |ndb|
49
49
  ndb << to_uid(*extensions).indent(2)
50
50
  ndb.OrgUid
51
- ndb.txtName(name)
51
+ ndb.txtName(name) if name
52
52
  ndb.valFreq(f.freq.trim)
53
53
  ndb.uomFreq(f.unit.upcase.to_s)
54
54
  ndb.codeDatum('WGE')
@@ -32,7 +32,7 @@ module AIXM
32
32
  tcn << to_uid(*extensions).indent(2)
33
33
  tcn.OrgUid
34
34
  tcn << vor.to_uid(*extensions).indent(2) if vor
35
- tcn.txtName(name)
35
+ tcn.txtName(name) if name
36
36
  tcn.codeChannel(channel)
37
37
  tcn.codeDatum('WGE')
38
38
  if z
@@ -104,7 +104,7 @@ module AIXM
104
104
  builder.Vor do |vor|
105
105
  vor << to_uid(*extensions).indent(2)
106
106
  vor.OrgUid
107
- vor.txtName(name)
107
+ vor.txtName(name) if name
108
108
  vor.codeType(type_key.to_s)
109
109
  vor.valFreq(f.freq.trim)
110
110
  vor.uomFreq(f.unit.upcase.to_s)
data/lib/aixm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AIXM
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
@@ -12,6 +12,10 @@ describe AIXM::Feature::NavigationalAid::Base do
12
12
  -> { base.send(:new, id: 'id', name: 'name', xy: AIXM::Factory.xy, z: AIXM.z(1, :qne)) }.must_raise ArgumentError
13
13
  end
14
14
 
15
+ it "accepts name to be nil" do
16
+ base.send(:new, id: 'id', xy: AIXM::Factory.xy).name.must_be_nil
17
+ end
18
+
15
19
  context "downcase attributes" do
16
20
  subject do
17
21
  base.send(:new, id: 'id', name: 'name', xy: AIXM::Factory.xy)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aixm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn