relaton-nist 0.3.2 → 0.3.3

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
  SHA1:
3
- metadata.gz: 2eafbe4c1cb7719d3f782f77547db4b759bd8c41
4
- data.tar.gz: 912039be62b33bdf6fab94966614e5de7adea3ac
3
+ metadata.gz: faceada8e94976b665bdb8599df2fc9889412bd9
4
+ data.tar.gz: e75e31cb091a6f1f9bfdb06ce801861a7f2f435c
5
5
  SHA512:
6
- metadata.gz: e49aaf8910c7fc910da3f7581fd4f6dcc3fb9beb0dba9575ca266d4bc5edf2d9a0b013470308553c9a30f563aad84c5c7ae9d85ccbc4715bc8480e7bcb27ccc4
7
- data.tar.gz: 84105c9c7612a47a9f3d6bebd873434147fa5a8e9ba0bedcc8ff0961939902eaf087fd3d08682eb2e45cbec10c262afabb4c5ec364d4f0e44262a061a6507048
6
+ metadata.gz: bddc62ce9bd2499c1fd88db7a1bb6457fdaa4e754165756cab7b019ba85106b3e5ff7bb51e11650416a7aa59f891fe6a5d73bde4de966e68d879db3e1d4b0beb
7
+ data.tar.gz: 9bafb3ad3192317101ce3b6ee0b8b5a463f82c5d3b4d8727a94d835bb3fb8db287acb04cbc42ed2ad6f4eebe77f896d12d04278fe9049efd35ae752c24202171
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-nist (0.3.2)
4
+ relaton-nist (0.3.3)
5
5
  relaton-bib (~> 0.3.0)
6
6
  rubyzip
7
7
 
@@ -35,7 +35,7 @@ GEM
35
35
  pry (~> 0.10)
36
36
  public_suffix (3.1.1)
37
37
  rake (10.5.0)
38
- relaton-bib (0.3.4)
38
+ relaton-bib (0.3.5)
39
39
  addressable
40
40
  nokogiri (~> 1.10)
41
41
  rspec (3.8.0)
@@ -26,5 +26,13 @@ module RelatonNist
26
26
  builder.extended extended.to_s if extended
27
27
  end
28
28
  end
29
+
30
+ # @return [Hash]
31
+ def to_hash
32
+ hash = { "from" => from.to_s }
33
+ hash["to"] = to.to_s if to
34
+ hash["extended"] = extended.to_s if extended
35
+ hash
36
+ end
29
37
  end
30
38
  end
@@ -1,5 +1,7 @@
1
1
  module RelatonNist
2
2
  class Keyword
3
+ include RelatonBib
4
+
3
5
  # @return [Nokogiri::XML::DocumentFragment]
4
6
  attr_reader :element
5
7
 
@@ -12,5 +14,10 @@ module RelatonNist
12
14
  def to_xml(builder)
13
15
  builder.keyword element.to_xml
14
16
  end
17
+
18
+ # @return [String]
19
+ def to_hash
20
+ element.text
21
+ end
15
22
  end
16
23
  end
@@ -6,7 +6,7 @@ module RelatonNist
6
6
  # @return [Array<RelatonNist::Keyword>]
7
7
  attr_reader :keyword
8
8
 
9
- # @return [RelatonNist::CommentPeriod]
9
+ # @return [RelatonNist::CommentPeriod, NilClass]
10
10
  attr_reader :commentperiod
11
11
 
12
12
  # @param id [String, NilClass]
@@ -31,7 +31,7 @@ module RelatonNist
31
31
  # @param fetched [Date, NilClass] default nil
32
32
  # @param doctype [String]
33
33
  # @param keyword [Array<RelatonNist::Keyword>]
34
- # @param commentperiod [RelatonNist::CommentPeriod]
34
+ # @param commentperiod [RelatonNist::CommentPeriod, NilClass]
35
35
  #
36
36
  # @param date [Array<Hash>]
37
37
  # @option date [String] :type
@@ -74,5 +74,13 @@ module RelatonNist
74
74
  end
75
75
  end
76
76
  end
77
+
78
+ # @return [Hash]
79
+ def to_hash
80
+ hash = super
81
+ hash["keyword"] = single_element_array(keyword) if keyword&.any?
82
+ hash["commentperiod"] = commentperiod.to_hash if commentperiod
83
+ hash
84
+ end
77
85
  end
78
86
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "0.3.2".freeze
2
+ VERSION = "0.3.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler